tiles-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r529532 - in /tiles/framework/trunk: tiles-core/src/main/java/org/apache/tiles/ tiles-core/src/main/java/org/apache/tiles/context/ tiles-core/src/main/java/org/apache/tiles/locale/impl/ tiles-core/src/test/java/org/apache/tiles/impl/ tiles-...
Date Tue, 17 Apr 2007 08:58:04 GMT
Author: apetrelli
Date: Tue Apr 17 01:58:03 2007
New Revision: 529532

URL: http://svn.apache.org/viewvc?view=rev&rev=529532
Log:
TILES-152
Removed Constants interface by moving its contained constants.

Removed:
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/Constants.java
Modified:
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/BasicAttributeContext.java
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/locale/impl/DefaultLocaleResolver.java
    tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
    tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java
    tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
    tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/BasicAttributeContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/BasicAttributeContext.java?view=diff&rev=529532&r1=529531&r2=529532
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/BasicAttributeContext.java
(original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/BasicAttributeContext.java
Tue Apr 17 01:58:03 2007
@@ -31,7 +31,6 @@
 
 import org.apache.tiles.Attribute;
 import org.apache.tiles.AttributeContext;
-import org.apache.tiles.Constants;
 
 /**
  * Basic implementation for <code>AttributeContext</code>.
@@ -41,6 +40,12 @@
 public class BasicAttributeContext implements AttributeContext, Serializable {
 
     /**
+     * Name used to store attribute context stack.
+     */
+    private static final String ATTRIBUTE_CONTEXT_STACK =
+        "org.apache.tiles.AttributeContext.STACK";
+
+    /**
      * Template attributes.
      */
     private Map<String, Attribute> attributes = null;
@@ -189,10 +194,10 @@
     public static Stack<AttributeContext> getContextStack(TilesRequestContext tilesContext)
{
         Stack<AttributeContext> contextStack =
             (Stack<AttributeContext>) tilesContext.getRequestScope().get(
-                Constants.ATTRIBUTE_CONTEXT_STACK);
+                BasicAttributeContext.ATTRIBUTE_CONTEXT_STACK);
         if (contextStack == null) {
             contextStack = new Stack<AttributeContext>();
-            tilesContext.getRequestScope().put(Constants.ATTRIBUTE_CONTEXT_STACK,
+            tilesContext.getRequestScope().put(BasicAttributeContext.ATTRIBUTE_CONTEXT_STACK,
                     contextStack);
         }
 

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/locale/impl/DefaultLocaleResolver.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/locale/impl/DefaultLocaleResolver.java?view=diff&rev=529532&r1=529531&r2=529532
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/locale/impl/DefaultLocaleResolver.java
(original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/locale/impl/DefaultLocaleResolver.java
Tue Apr 17 01:58:03 2007
@@ -23,7 +23,6 @@
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.tiles.Constants;
 import org.apache.tiles.TilesException;
 import org.apache.tiles.context.TilesRequestContext;
 import org.apache.tiles.locale.LocaleResolver;
@@ -31,13 +30,18 @@
 /**
  * Default implementation of <code>LocaleResolver</code><br>
  * It tries to take the locale from the session-scoped attribute
- * {@link Constants#LOCALE_KEY}. If it is not found, it returns the
+ * {@link DefaultLocaleResolver#LOCALE_KEY}. If it is not found, it returns the
  * locale included in the request.
  *
  * @version $Rev$ $Date$
  */
 public class DefaultLocaleResolver implements LocaleResolver {
 
+    /**
+     * The attribute name that is used to store the current locale.
+     */
+    public static final String LOCALE_KEY = "org.apache.tiles.LOCALE";
+
     /** {@inheritDoc} */
     public void init(Map<String, String> params)
             throws TilesException {
@@ -49,7 +53,7 @@
         Locale retValue = null;
         Map<String, Object> session = request.getSessionScope();
         if (session != null) {
-            retValue = (Locale) session.get(Constants.LOCALE_KEY);
+            retValue = (Locale) session.get(DefaultLocaleResolver.LOCALE_KEY);
         }
         if (retValue == null) {
             retValue = request.getRequestLocale();

Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java?view=diff&rev=529532&r1=529531&r2=529532
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
(original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
Tue Apr 17 01:58:03 2007
@@ -33,11 +33,11 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tiles.Constants;
 import org.apache.tiles.TilesException;
 import org.apache.tiles.definition.DefinitionsFactory;
 import org.apache.tiles.factory.KeyedDefinitionsFactoryTilesContainerFactory;
 import org.apache.tiles.factory.TilesContainerFactory;
+import org.apache.tiles.locale.impl.DefaultLocaleResolver;
 import org.apache.tiles.util.RollingVectorEnumeration;
 import org.easymock.EasyMock;
 
@@ -184,7 +184,7 @@
         EasyMock.reset(session);
         EasyMock.reset(response);
         EasyMock.expect(request.getSession()).andReturn(session).anyTimes();
-        EasyMock.expect(session.getAttribute(Constants.LOCALE_KEY)).andReturn(null).anyTimes();
+        EasyMock.expect(session.getAttribute(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null).anyTimes();
         EasyMock.expect(request.getLocale()).andReturn(null).anyTimes();
         EasyMock.expect(request.getAttribute(
                 KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
@@ -203,7 +203,7 @@
                 KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
                 .andReturn("one").anyTimes();
         EasyMock.expect(request.getSession()).andReturn(session).anyTimes();
-        EasyMock.expect(session.getAttribute(Constants.LOCALE_KEY)).andReturn(null).anyTimes();
+        EasyMock.expect(session.getAttribute(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null).anyTimes();
         EasyMock.expect(request.getLocale()).andReturn(null).anyTimes();
         EasyMock.replay(request);
         EasyMock.replay(session);
@@ -219,7 +219,7 @@
                 KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
                 .andReturn("two").anyTimes();
         EasyMock.expect(request.getSession()).andReturn(session).anyTimes();
-        EasyMock.expect(session.getAttribute(Constants.LOCALE_KEY)).andReturn(null).anyTimes();
+        EasyMock.expect(session.getAttribute(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null).anyTimes();
         EasyMock.expect(request.getLocale()).andReturn(null).anyTimes();
         EasyMock.replay(request);
         EasyMock.replay(session);

Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java?view=diff&rev=529532&r1=529531&r2=529532
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java
(original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java
Tue Apr 17 01:58:03 2007
@@ -21,7 +21,6 @@
 
 package org.apache.tiles.jsp.taglib;
 
-import org.apache.tiles.Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -57,8 +56,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class AddAttributeTag extends RoleSecurityTagSupport implements
-        Constants {
+public class AddAttributeTag extends RoleSecurityTagSupport {
 
     /**
      * The logging object.

Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java?view=diff&rev=529532&r1=529531&r2=529532
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
(original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
Tue Apr 17 01:58:03 2007
@@ -21,7 +21,6 @@
 
 package org.apache.tiles.jsp.taglib;
 
-import org.apache.tiles.Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -68,7 +67,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class PutAttributeTag extends RoleSecurityTagSupport implements Constants {
+public class PutAttributeTag extends RoleSecurityTagSupport {
 
     /**
      * The logging object.

Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java?view=diff&rev=529532&r1=529531&r2=529532
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java
(original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java
Tue Apr 17 01:58:03 2007
@@ -32,7 +32,7 @@
 import org.apache.tiles.TilesContainer;
 import org.apache.tiles.TilesException;
 import org.apache.tiles.access.TilesAccess;
-import org.apache.tiles.Constants;
+import org.apache.tiles.locale.impl.DefaultLocaleResolver;
 
 /**
  * Servlet able to let a user choose a locale.
@@ -80,7 +80,7 @@
                 locale = new Locale(localeStrings[0], localeStrings[1], localeStrings[2]);
             }
         }
-        session.setAttribute(Constants.LOCALE_KEY, locale);
+        session.setAttribute(DefaultLocaleResolver.LOCALE_KEY, locale);
         TilesContainer container = TilesAccess.getContainer(request
                 .getSession().getServletContext());
         try {



Mime
View raw message