You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2010/05/20 02:18:57 UTC

svn commit: r946491 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/internal/ main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ test/java/org/apac...

Author: hlship
Date: Thu May 20 00:18:56 2010
New Revision: 946491

URL: http://svn.apache.org/viewvc?rev=946491&view=rev
Log:
TAP5-1159: Refactor TEMPLATE_EXTENSION from InternalConstants to the new TapestryConstants class

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryConstants.java   (with props)
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalConstants.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageTemplateLocatorImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StaticFilesFilter.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImplTest.java

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryConstants.java?rev=946491&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryConstants.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryConstants.java Thu May 20 00:18:56 2010
@@ -0,0 +1,31 @@
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5;
+
+/**
+ * Constants needed by end-user classes.
+ * 
+ * @since 5.2.0
+ */
+public class TapestryConstants
+{
+
+    /**
+     * The extension used for Tapestry component template files, <em>T</em>apestry <em>M</em>arkup <em>L</em>anguage.
+     * Template files are well-formed XML files.
+     */
+    public static final String TEMPLATE_EXTENSION = "tml";
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalConstants.java?rev=946491&r1=946490&r2=946491&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalConstants.java Thu May 20 00:18:56 2010
@@ -33,12 +33,6 @@ public final class InternalConstants
     public static final String DISABLE_DEFAULT_MODULES_PARAM = "tapestry.disable-default-modules";
 
     /**
-     * The extension used for Tapestry component template files, <em>T</em>apestry <em>M</em>arkup <em>L</em>anguage.
-     * Template files are well-formed XML files.
-     */
-    public static final String TEMPLATE_EXTENSION = "tml";
-
-    /**
      * The name of the query parameter that stores the page activation context inside an action
      * request.
      */

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImpl.java?rev=946491&r1=946490&r2=946491&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImpl.java Thu May 20 00:18:56 2010
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 
 package org.apache.tapestry5.internal.services;
 
-import org.apache.tapestry5.internal.InternalConstants;
+import org.apache.tapestry5.TapestryConstants;
 import org.apache.tapestry5.internal.event.InvalidationEventHubImpl;
 import org.apache.tapestry5.internal.parser.ComponentTemplate;
 import org.apache.tapestry5.internal.parser.TemplateToken;
@@ -190,7 +190,7 @@ public final class ComponentTemplateSour
 
     private Resource baseResourceForModel(ComponentModel model)
     {
-        return model.getBaseResource().withExtension(InternalConstants.TEMPLATE_EXTENSION);
+        return model.getBaseResource().withExtension(TapestryConstants.TEMPLATE_EXTENSION);
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageTemplateLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageTemplateLocatorImpl.java?rev=946491&r1=946490&r2=946491&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageTemplateLocatorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageTemplateLocatorImpl.java Thu May 20 00:18:56 2010
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 
 package org.apache.tapestry5.internal.services;
 
-import org.apache.tapestry5.internal.InternalConstants;
+import org.apache.tapestry5.TapestryConstants;
 import org.apache.tapestry5.ioc.Resource;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.model.ComponentModel;
@@ -57,7 +57,7 @@ public class PageTemplateLocatorImpl imp
             logicalName = logicalName.substring(0, slashx + 1) + simpleClassName;
         }
 
-        String path = format("%s.%s", logicalName, InternalConstants.TEMPLATE_EXTENSION);
+        String path = format("%s.%s", logicalName, TapestryConstants.TEMPLATE_EXTENSION);
 
         return contextRoot.forFile(path).forLocale(locale);
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StaticFilesFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StaticFilesFilter.java?rev=946491&r1=946490&r2=946491&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StaticFilesFilter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StaticFilesFilter.java Thu May 20 00:18:56 2010
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,13 +14,18 @@
 
 package org.apache.tapestry5.internal.services;
 
-import org.apache.tapestry5.internal.InternalConstants;
-import org.apache.tapestry5.services.*;
-
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URL;
 
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tapestry5.TapestryConstants;
+import org.apache.tapestry5.services.Context;
+import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.RequestFilter;
+import org.apache.tapestry5.services.RequestHandler;
+import org.apache.tapestry5.services.Response;
+
 /**
  * Identifies requests that are for actual resource files in the context. For those, Tapestry allows the servlet
  * container to process the request.
@@ -68,7 +73,7 @@ public class StaticFilesFilter implement
                     // It is considered a security risk, like seeing a raw JSP. Earlier alpha versions
                     // of Tapestry required that the templates be stored in WEB-INF.
 
-                    if (suffix.equalsIgnoreCase(InternalConstants.TEMPLATE_EXTENSION))
+                    if (suffix.equalsIgnoreCase(TapestryConstants.TEMPLATE_EXTENSION))
                     {
 
                         response.sendError(HttpServletResponse.SC_FORBIDDEN, ServicesMessages

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=946491&r1=946490&r2=946491&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Thu May 20 00:18:56 2010
@@ -2324,7 +2324,7 @@ public final class TapestryModule
         configuration.add("properties");
 
         // Likewise, we don't want people fishing for templates.
-        configuration.add(InternalConstants.TEMPLATE_EXTENSION);
+        configuration.add(TapestryConstants.TEMPLATE_EXTENSION);
     }
 
     public static void contributeTemplateParser(MappedConfiguration<String, URL> config)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImplTest.java?rev=946491&r1=946490&r2=946491&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentTemplateSourceImplTest.java Thu May 20 00:18:56 2010
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 
 package org.apache.tapestry5.internal.services;
 
-import org.apache.tapestry5.internal.InternalConstants;
+import org.apache.tapestry5.TapestryConstants;
 import org.apache.tapestry5.internal.parser.ComponentTemplate;
 import org.apache.tapestry5.internal.test.InternalBaseTestCase;
 import org.apache.tapestry5.ioc.Resource;
@@ -86,7 +86,7 @@ public class ComponentTemplateSourceImpl
         train_getBaseResource(model, baseResource);
 
         train_parseTemplate(parser, baseResource
-                .withExtension(InternalConstants.TEMPLATE_EXTENSION), template);
+                .withExtension(TapestryConstants.TEMPLATE_EXTENSION), template);
 
         replay();
 
@@ -120,7 +120,7 @@ public class ComponentTemplateSourceImpl
         f.createNewFile();
 
         Resource baseResource = new ClasspathResource(loader, "baz/Biff.class");
-        Resource localized = baseResource.withExtension(InternalConstants.TEMPLATE_EXTENSION);
+        Resource localized = baseResource.withExtension(TapestryConstants.TEMPLATE_EXTENSION);
 
         TemplateParser parser = mockTemplateParser();
         ComponentTemplate template = mockComponentTemplate();
@@ -194,7 +194,7 @@ public class ComponentTemplateSourceImpl
         train_getBaseResource(model, baseResource);
 
         train_parseTemplate(parser, baseResource
-                .withExtension(InternalConstants.TEMPLATE_EXTENSION), template);
+                .withExtension(TapestryConstants.TEMPLATE_EXTENSION), template);
 
         replay();
 
@@ -298,7 +298,7 @@ public class ComponentTemplateSourceImpl
 
         train_parseTemplate(
                 parser,
-                baseFred.withExtension(InternalConstants.TEMPLATE_EXTENSION),
+                baseFred.withExtension(TapestryConstants.TEMPLATE_EXTENSION),
                 template);
 
         replay();