commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eli...@apache.org
Subject svn commit: r1366094 - in /commons/proper/chain/trunk: apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ sdocbook/ src/changes/ src/site/xdoc/ web/src/main/java/org/a...
Date Thu, 26 Jul 2012 17:29:32 GMT
Author: elijah
Date: Thu Jul 26 17:29:31 2012
New Revision: 1366094

URL: http://svn.apache.org/viewvc?rev=1366094&view=rev
Log:
CHAIN-47

Refactored ServletWebContext and WebContext to an interface.

Added:
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java   (contents, props changed)
      - copied, changed from r1365837, commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java   (contents, props changed)
      - copied, changed from r1365837, commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java   (contents, props changed)
      - copied, changed from r1365837, commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextTestCase.java
Removed:
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextTestCase.java
Modified:
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
    commons/proper/chain/trunk/sdocbook/chapter-chain.xml
    commons/proper/chain/trunk/src/changes/changes.xml
    commons/proper/chain/trunk/src/site/xdoc/cookbook.xml
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/faces/FacesWebContext.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java
    commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/ChainResourcesTestCase.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletWebContextTestCase.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ChainProcessorTestCase.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java
    commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java

Modified: commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java (original)
+++ commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java Thu Jul 26 17:29:31 2012
@@ -27,7 +27,8 @@ import org.apache.commons.logging.LogFac
  *
  * @version $Id$
  */
-public class CountCommand implements Command<String, Object, WebContext> {
+public class CountCommand implements Command<String, Object,
+        WebContext<String, Object>> {
 
     private Log log = LogFactory.getLog(CountCommand.class);
 

Modified: commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java (original)
+++ commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java Thu Jul 26 17:29:31 2012
@@ -31,7 +31,7 @@ import java.lang.RuntimeException;
  *
  * @version $Id$
  */
-public class ForwardCommand implements Command<String, Object, ServletWebContext> {
+public class ForwardCommand implements Command<String, Object, ServletWebContext<String, Object>> {
 
     private Log log = LogFactory.getLog(ForwardCommand.class);
 
@@ -61,7 +61,7 @@ public class ForwardCommand implements C
      * @param context The {@link Context} we are operating on
      * @return <code>false</code> so that processng will continue
      */
-    public boolean execute(ServletWebContext context) {
+    public boolean execute(ServletWebContext<String, Object> context) {
         try {
             String uri = getForward(context);
             if (uri != null) {

Modified: commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java (original)
+++ commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java Thu Jul 26 17:29:31 2012
@@ -27,7 +27,8 @@ import org.apache.commons.logging.LogFac
  *
  * @version $Id$
  */
-public class CountCommand implements Command<String, Object, WebContext> {
+public class CountCommand implements Command<String, Object,
+        WebContext<String, Object>> {
 
     private Log log = LogFactory.getLog(CountCommand.class);
 

Modified: commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java (original)
+++ commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java Thu Jul 26 17:29:31 2012
@@ -20,6 +20,7 @@ import org.apache.commons.chain2.Catalog
 import org.apache.commons.chain2.CatalogFactory;
 import org.apache.commons.chain2.Command;
 import org.apache.commons.chain2.web.servlet.ServletWebContext;
+import org.apache.commons.chain2.web.servlet.ServletWebContextBase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -59,7 +60,7 @@ public class ExampleServlet extends Http
     }
 
     /**
-     * <p>Configure a {@link ServletWebContext} for the current request, and
+     * <p>Configure a {@link org.apache.commons.chain2.web.servlet.ServletWebContext} for the current request, and
      * pass it to the <code>execute()</code> method of the specified
      * {@link Command}, loaded from our configured {@link Catalog}.</p>
      *
@@ -72,15 +73,20 @@ public class ExampleServlet extends Http
                         HttpServletResponse response)
         throws IOException {
 
-        CatalogFactory<String, Object, ServletWebContext> factory = CatalogFactory.getInstance();
-        Catalog<String, Object, ServletWebContext> catalog = factory.getCatalog(servletName);
+        CatalogFactory<String, Object, ServletWebContext<String, Object>> factory =
+                CatalogFactory.getInstance();
+        Catalog<String, Object, ServletWebContext<String, Object>> catalog =
+                factory.getCatalog(servletName);
+
         if (catalog == null) {
             catalog = factory.getCatalog();
         }
 
-        ServletWebContext context =
-            new ServletWebContext(getServletContext(), request, response);
-        Command<String, Object, ServletWebContext> command = catalog.getCommand("COMMAND_MAPPER");
+        ServletWebContext<String, Object> context =
+            new ServletWebContextBase(getServletContext(), request, response);
+
+        Command<String, Object, ServletWebContext<String, Object>> command = catalog.
+                <Command<String, Object, ServletWebContext<String, Object>>>getCommand("COMMAND_MAPPER");
         command.execute(context);
     }
 

Modified: commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java (original)
+++ commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java Thu Jul 26 17:29:31 2012
@@ -30,7 +30,7 @@ import java.io.IOException;
  *
  * @version $Id$
  */
-public class ForwardCommand implements Command<String, Object, ServletWebContext> {
+public class ForwardCommand implements Command<String, Object, ServletWebContext<String, Object>> {
 
     private Log log = LogFactory.getLog(ForwardCommand.class);
 
@@ -60,7 +60,7 @@ public class ForwardCommand implements C
      * @param context The {@link Context} we are operating on
      * @return <code>false</code> so that processng will continue
      */
-    public boolean execute(ServletWebContext context) {
+    public boolean execute(ServletWebContext<String, Object> context) {
         try {
             String uri = getForward(context);
             if (uri != null) {
@@ -89,7 +89,7 @@ public class ForwardCommand implements C
      * @param context The {@link Context} we are operating on
      * @return The uri to forward to
      */
-    protected String getForward(ServletWebContext context) {
+    protected String getForward(ServletWebContext<String, Object> context) {
         String uri = (String)context.get("forward");
         if (uri == null) {
             uri = getForward();

Modified: commons/proper/chain/trunk/sdocbook/chapter-chain.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/sdocbook/chapter-chain.xml?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/sdocbook/chapter-chain.xml (original)
+++ commons/proper/chain/trunk/sdocbook/chapter-chain.xml Thu Jul 26 17:29:31 2012
@@ -973,7 +973,7 @@ public class MailReader extends Hashmap 
 import org.apache.commons.chain2.Catalog;
 import org.apache.commons.chain2.Command;
 import org.apache.commons.chain2.Context;
-import org.apache.commons.chain2.web.servlet.ServletWebContext;
+import org.apache.commons.chain2.web.servlet.ServletWebContextBase;
 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;as the ActionForm name.

Modified: commons/proper/chain/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/changes/changes.xml?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/changes/changes.xml (original)
+++ commons/proper/chain/trunk/src/changes/changes.xml Thu Jul 26 17:29:31 2012
@@ -41,6 +41,9 @@ The <action> type attribute can be add,u
 
   <body>
     <release version="2.0" description="Major release">
+      <action dev="elijah" type="fix" issue="CHAIN-47">
+          WebContext, ServletWebContext are now interfaces
+      </action>
       <action dev="elijah" type="update" issue="CHAIN-75">
         Update serialVersionUID in all classes to a date based format.
       </action>

Modified: commons/proper/chain/trunk/src/site/xdoc/cookbook.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/site/xdoc/cookbook.xml?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/site/xdoc/cookbook.xml (original)
+++ commons/proper/chain/trunk/src/site/xdoc/cookbook.xml Thu Jul 26 17:29:31 2012
@@ -977,7 +977,7 @@ public class MailReader extends Hashmap<
 import org.apache.commons.chain2.Catalog;
 import org.apache.commons.chain2.Command;
 import org.apache.commons.chain2.Context;
-import org.apache.commons.chain2.web.servlet.ServletWebContext;
+import org.apache.commons.chain2.web.servlet.ServletWebContextBase;
 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;as the ActionForm name.

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java Thu Jul 26 17:29:31 2012
@@ -30,7 +30,7 @@ import java.util.Locale;
  *
  * @version $Id$
  */
-public abstract class AbstractGetLocaleCommand<C extends WebContext>
+public abstract class AbstractGetLocaleCommand<C extends WebContext<String, Object>>
         implements Command<String, Object, C> {
 
     // -------------------------------------------------------------- Properties

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java Thu Jul 26 17:29:31 2012
@@ -31,7 +31,7 @@ import java.util.Locale;
  *
  * @version $Id$
  */
-public abstract class AbstractSetLocaleCommand<C extends WebContext>
+public abstract class AbstractSetLocaleCommand<C extends WebContext<String, Object>>
         implements Command<String, Object, C> {
 
     // -------------------------------------------------------------- Properties

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java Thu Jul 26 17:29:31 2012
@@ -165,15 +165,16 @@ public class ChainListener implements Se
         String webResources = context.getInitParameter(CONFIG_WEB_RESOURCE);
 
         // Retrieve or create the Catalog instance we may be updating
-        Catalog<String, Object, ServletWebContext> catalog = null;
+        Catalog<String, Object, ServletWebContext<String, Object>> catalog = null;
         if (attr != null) {
+            Object catalogRef = context.getAttribute(attr);
 
-            /* Assume that we are getting an object of the type Catalog from the context's
-             * attribute because that is the historical contract. */
-            catalog = (Catalog<String, Object, ServletWebContext>) context.getAttribute(attr);
-
-            if (catalog == null) {
-                catalog = new CatalogBase<String, Object, ServletWebContext>();
+            if (catalogRef == null || !(catalogRef instanceof Catalog) ) {
+                catalog = new CatalogBase<String, Object, ServletWebContext<String, Object>>();
+            } else {
+                /* Assume that we are getting an object of the type Catalog from the context's
+                 * attribute because that is the historical contract. */
+                catalog = (Catalog<String, Object, ServletWebContext<String, Object>>)catalogRef;
             }
         }
 

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java Thu Jul 26 17:29:31 2012
@@ -167,11 +167,14 @@ public class ChainServlet extends HttpSe
         String webResources = context.getInitParameter(CONFIG_WEB_RESOURCE);
 
         // Retrieve or create the Catalog instance we may be updating
-        Catalog<String, Object, ServletWebContext> catalog = null;
+        Catalog<String, Object, ServletWebContext<String, Object>> catalog = null;
         if (attr != null) {
-            catalog = (Catalog<String, Object, ServletWebContext>) context.getAttribute(attr);
-            if (catalog == null) {
-                catalog = new CatalogBase<String, Object, ServletWebContext>();
+            Object catalogRef = context.getAttribute(attr);
+
+            if (catalogRef == null || !(catalogRef instanceof Catalog)) {
+                catalog = new CatalogBase<String, Object, ServletWebContext<String, Object>>();
+            } else {
+                catalog = (Catalog<String, Object, ServletWebContext<String, Object>>)catalogRef;
             }
         }
 

Added: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java?rev=1366094&view=auto
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java (added)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java Thu Jul 26 17:29:31 2012
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.web;
+
+import org.apache.commons.chain2.Context;
+
+import javax.servlet.http.Cookie;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ *
+ * @version $Id: $
+ */
+public interface WebContext<K, V> extends Context<K, V>, Serializable {
+    /**
+     * <p>Return a mutable <code>Map</code> that maps application scope
+     * attribute names to their values.</p>
+     *
+     * @return Application scope Map.
+     */
+    Map<String, Object> getApplicationScope();
+
+    /**
+     * <p>Return an immutable <code>Map</code> that maps header names to
+     * the first (or only) header value (as a String).  Header names must
+     * be matched in a case-insensitive manner.</p>
+     *
+     * @return Header values Map.
+     */
+    Map<String, String> getHeader();
+
+    /**
+     * <p>Return an immutable <code>Map</code> that maps header names to
+     * the set of all values specified in the request (as a String array).
+     * Header names must be matched in a case-insensitive manner.</p>
+     *
+     * @return Header values Map.
+     */
+    Map<String, String[]> getHeaderValues();
+
+    /**
+     * <p>Return an immutable <code>Map</code> that maps context application
+     * initialization parameters to their values.</p>
+     *
+     * @return Initialization parameter Map.
+     */
+    Map<String, String> getInitParam();
+
+    /**
+     * <p>Return an immutable <code>Map</code> that maps request parameter
+     * names to the first (or only) value (as a String).</p>
+     *
+     * @return Request parameter Map.
+     */
+    Map<String, String> getParam();
+
+    /**
+     * <p>Return an immutable <code>Map</code> that maps request parameter
+     * names to the set of all values (as a String array).</p>
+     *
+     * @return Request parameter Map.
+     */
+    Map<String, String[]> getParamValues();
+
+    /**
+     * <p>Return an immutable <code>Map</code> that maps cookie names to
+     * the set of cookies specified in the request.
+     *
+     * @return Map of Cookies.
+     * @since Chain 1.1
+     */
+    Map<String, Cookie> getCookies();
+
+    /**
+     * <p>Return a mutable <code>Map</code> that maps request scope
+     * attribute names to their values.</p>
+     *
+     * @return Request scope Map.
+     */
+    Map<String, Object> getRequestScope();
+
+    /**
+     * <p>Return a mutable <code>Map</code> that maps session scope
+     * attribute names to their values.</p>
+     *
+     * @return Session scope Map.
+     */
+    Map<String, Object> getSessionScope();
+}

Copied: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java (from r1365837, commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java)
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java?p2=commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java&p1=commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java&r1=1365837&r2=1366094&rev=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContext.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java Thu Jul 26 17:29:31 2012
@@ -18,15 +18,12 @@ package org.apache.commons.chain2.web;
 
 import org.apache.commons.chain2.impl.ContextBase;
 
-import javax.servlet.http.Cookie;
-import java.util.Map;
-
 /**
  * <p>Abstract base implementation of {@link org.apache.commons.chain2.Context} that
  * provides web based applications that use it a "generic" view of HTTP related
  * requests and responses, without tying the application to a particular underlying
  * Java API (such as servlets).  It is expected that a concrete subclass
- * of {@link WebContext} for each API (such as
+ * of {@link WebContextBase} for each API (such as
  * {@link org.apache.commons.chain2.web.servlet.ServletWebContext})
  * will support adapting that particular API's implementation of request
  * and response objects into this generic framework.</p>
@@ -37,7 +34,8 @@ import java.util.Map;
  *
  * @version $Id$
  */
-public abstract class WebContext extends ContextBase {
+public abstract class WebContextBase extends ContextBase
+        implements WebContext<String, Object> {
 
     /**
      *
@@ -46,79 +44,4 @@ public abstract class WebContext extends
 
     // ---------------------------------------------------------- Public Methods
 
-    /**
-     * <p>Return a mutable <code>Map</code> that maps application scope
-     * attribute names to their values.</p>
-     *
-     * @return Application scope Map.
-     */
-    public abstract Map<String, Object> getApplicationScope();
-
-    /**
-     * <p>Return an immutable <code>Map</code> that maps header names to
-     * the first (or only) header value (as a String).  Header names must
-     * be matched in a case-insensitive manner.</p>
-     *
-     * @return Header values Map.
-     */
-    public abstract Map<String, String> getHeader();
-
-    /**
-     * <p>Return an immutable <code>Map</code> that maps header names to
-     * the set of all values specified in the request (as a String array).
-     * Header names must be matched in a case-insensitive manner.</p>
-     *
-     * @return Header values Map.
-     */
-    public abstract Map<String, String[]> getHeaderValues();
-
-    /**
-     * <p>Return an immutable <code>Map</code> that maps context application
-     * initialization parameters to their values.</p>
-     *
-     * @return Initialization parameter Map.
-     */
-    public abstract Map<String, String> getInitParam();
-
-    /**
-     * <p>Return an immutable <code>Map</code> that maps request parameter
-     * names to the first (or only) value (as a String).</p>
-     *
-     * @return Request parameter Map.
-     */
-    public abstract Map<String, String> getParam();
-
-    /**
-     * <p>Return an immutable <code>Map</code> that maps request parameter
-     * names to the set of all values (as a String array).</p>
-     *
-     * @return Request parameter Map.
-     */
-    public abstract Map<String, String[]> getParamValues();
-
-    /**
-     * <p>Return an immutable <code>Map</code> that maps cookie names to
-     * the set of cookies specified in the request.
-     *
-     * @return Map of Cookies.
-     * @since Chain 1.1
-     */
-    public abstract Map<String, Cookie> getCookies();
-
-    /**
-     * <p>Return a mutable <code>Map</code> that maps request scope
-     * attribute names to their values.</p>
-     *
-     * @return Request scope Map.
-     */
-    public abstract Map<String, Object> getRequestScope();
-
-    /**
-     * <p>Return a mutable <code>Map</code> that maps session scope
-     * attribute names to their values.</p>
-     *
-     * @return Session scope Map.
-     */
-    public abstract Map<String, Object> getSessionScope();
-
 }

Propchange: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/WebContextBase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/faces/FacesWebContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/faces/FacesWebContext.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/faces/FacesWebContext.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/faces/FacesWebContext.java Thu Jul 26 17:29:31 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.chain2.web.faces;
 
-import org.apache.commons.chain2.web.WebContext;
+import org.apache.commons.chain2.web.WebContextBase;
 
 import javax.faces.context.FacesContext;
 import javax.servlet.http.Cookie;
@@ -25,14 +25,14 @@ import java.util.Iterator;
 import java.util.Map;
 
 /**
- * <p>Concrete implementation of {@link WebContext} suitable for use in
+ * <p>Concrete implementation of {@link org.apache.commons.chain2.web.WebContext} suitable for use in
  * JavaServer Faces apps.  The abstract methods are mapped to the appropriate
  * collections of the underlying <code>FacesContext</code> instance
  * that is passed to the constructor (or the initialize method).</p>
  *
  * @version $Id$
  */
-public class FacesWebContext extends WebContext {
+public class FacesWebContext extends WebContextBase {
 
     // ------------------------------------------------------------ Constructors
 
@@ -61,7 +61,7 @@ public class FacesWebContext extends Web
 
     /**
      * <p>The <code>FacesContext</code> instance for the request represented
-     * by this {@link WebContext}.</p>
+     * by this {@link org.apache.commons.chain2.web.WebContext}.</p>
      */
     private FacesContext context = null;
 
@@ -97,10 +97,10 @@ public class FacesWebContext extends Web
         context = null;
     }
 
-    // ------------------------------------------------------ WebContext Methods
+    // ------------------------------------------------------ WebContextBase Methods
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Application scope Map.
      */
@@ -112,7 +112,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Header values Map.
      */
@@ -125,7 +125,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Header values Map.
      */
@@ -138,7 +138,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Initialization parameter Map.
      */
@@ -151,7 +151,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Request parameter Map.
      */
@@ -164,7 +164,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Request parameter Map.
      */
@@ -177,7 +177,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Map of Cookies.
      * @since Chain 1.1
@@ -214,7 +214,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Request scope Map.
      */
@@ -227,7 +227,7 @@ public class FacesWebContext extends Web
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Session scope Map.
      */

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java Thu Jul 26 17:29:31 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.chain2.web.portlet;
 
-import org.apache.commons.chain2.web.WebContext;
+import org.apache.commons.chain2.web.WebContextBase;
 
 import javax.portlet.PortletContext;
 import javax.portlet.PortletRequest;
@@ -26,14 +26,14 @@ import java.util.Collections;
 import java.util.Map;
 
 /**
- * <p>Concrete implementation of {@link WebContext} suitable for use in
+ * <p>Concrete implementation of {@link org.apache.commons.chain2.web.WebContext} suitable for use in
  * portlets.  The abstract methods are mapped to the appropriate
  * collections of the underlying portlet context, request, and response
  * instances that are passed to the constructor (or the initialize method).</p>
  *
  * @version $Id$
  */
-public class PortletWebContext extends WebContext {
+public class PortletWebContext extends WebContextBase {
 
     /**
      *
@@ -198,10 +198,10 @@ public class PortletWebContext extends W
         response = null;
     }
 
-    // ------------------------------------------------------ WebContext Methods
+    // ------------------------------------------------------ WebContextBase Methods
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Application scope Map.
      */
@@ -213,7 +213,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Header values Map.
      */
@@ -226,7 +226,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Header values Map.
      */
@@ -239,7 +239,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Initialization parameter Map.
      */
@@ -251,7 +251,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Request parameter Map.
      */
@@ -263,7 +263,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Request parameter Map.
      */
@@ -285,7 +285,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Request scope Map.
      */
@@ -297,7 +297,7 @@ public class PortletWebContext extends W
     }
 
     /**
-     * See the {@link WebContext}'s Javadoc.
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
      *
      * @return Session scope Map.
      */

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java Thu Jul 26 17:29:31 2012
@@ -159,9 +159,9 @@ public class ChainProcessor extends Chai
     public void service(HttpServletRequest request, HttpServletResponse response)
         throws IOException, ServletException {
 
-        ServletWebContext context =
-            new ServletWebContext(getServletContext(), request, response);
-        Catalog<String, Object, ServletWebContext> theCatalog;
+        ServletWebContext<String, Object> context =
+            new ServletWebContextBase(getServletContext(), request, response);
+        Catalog<String, Object, ServletWebContext<String, Object>> theCatalog;
 
         if (attribute != null) {
             ServletContext servletContext = getServletContext();
@@ -174,8 +174,8 @@ public class ChainProcessor extends Chai
                  * here, we still need to suppress warnings because of the
                  * type erasure of generics. */
                 @SuppressWarnings("unchecked")
-                Catalog<String, Object, ServletWebContext> attributeCatalog =
-                     (Catalog<String, Object, ServletWebContext>)testAttribute;
+                Catalog<String, Object, ServletWebContext<String, Object>> attributeCatalog =
+                     (Catalog<String, Object, ServletWebContext<String, Object>>)testAttribute;
                 theCatalog = attributeCatalog;
             } else {
                 String msg = "The object stored as the attribute [" +
@@ -184,14 +184,17 @@ public class ChainProcessor extends Chai
                 throw new IllegalArgumentException(msg);
             }
         } else if (catalog != null) {
-            theCatalog = CatalogFactory.<String, Object, ServletWebContext>getInstance().getCatalog(catalog);
+            theCatalog = CatalogFactory.<String, Object, ServletWebContext<String, Object>>getInstance()
+                    .getCatalog(catalog);
         } else {
-            theCatalog = CatalogFactory.<String, Object, ServletWebContext>getInstance().getCatalog();
+            theCatalog = CatalogFactory.<String, Object, ServletWebContext<String, Object>>getInstance()
+                    .getCatalog();
         }
         if (attribute == null) {
             request.setAttribute(CATALOG_DEFAULT, theCatalog);
         }
-        Command<String, Object, ServletWebContext> cmd = theCatalog.getCommand(this.command);
+        Command<String, Object, ServletWebContext<String, Object>> cmd = theCatalog
+                .<Command<String, Object, ServletWebContext<String, Object>>>getCommand(this.command);
         try {
             cmd.execute(context);
         } catch (Exception e) {

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java Thu Jul 26 17:29:31 2012
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletReq
  *
  * @version $Id$
  */
-public class PathInfoMapper extends LookupCommand<String, Object, ServletWebContext> {
+public class PathInfoMapper extends LookupCommand<String, Object, ServletWebContext<String, Object>> {
 
     // --------------------------------------------------------- Command Methods
 
@@ -48,7 +48,7 @@ public class PathInfoMapper extends Look
      * @since Chain 1.2
      */
     @Override
-    protected String getCommandName(ServletWebContext context) {
+    protected String getCommandName(ServletWebContext<String, Object> context) {
         // Look up the extra path information for this request
         HttpServletRequest request = context.getRequest();
         String pathInfo = (String)
@@ -71,12 +71,13 @@ public class PathInfoMapper extends Look
      * @since Chain 1.2
      */
     @Override
-    protected Catalog<String, Object, ServletWebContext> getCatalog(ServletWebContext context) {
+    protected Catalog<String, Object, ServletWebContext<String, Object>>
+            getCatalog(ServletWebContext<String, Object> context) {
         /* Assume that the object returned will be a catalog because of chain's
          * historical contract. */
         @SuppressWarnings("unchecked")
-        Catalog<String, Object, ServletWebContext> catalog =
-                (Catalog<String, Object, ServletWebContext>) context.get(getCatalogName());
+        Catalog<String, Object, ServletWebContext<String, Object>> catalog =
+                (Catalog<String, Object, ServletWebContext<String, Object>>) context.get(getCatalogName());
         if (catalog == null) {
             catalog = super.getCatalog(context);
         }

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java Thu Jul 26 17:29:31 2012
@@ -36,7 +36,7 @@ import javax.servlet.http.HttpServletReq
  * @version $Id$
  */
 public class RequestParameterMapper
-        extends LookupCommand<String, Object, ServletWebContext> {
+        extends LookupCommand<String, Object, ServletWebContext<String, Object>> {
 
     // ------------------------------------------------------ Instance Variables
 
@@ -96,12 +96,13 @@ public class RequestParameterMapper
      * @since Chain 1.2
      */
     @Override
-    protected Catalog<String, Object, ServletWebContext> getCatalog(ServletWebContext context) {
+    protected Catalog<String, Object, ServletWebContext<String, Object>>
+            getCatalog(ServletWebContext<String, Object> context) {
         /* Assume that the returned value will be null or of a valid catalog
          * type according to chain's historical contract. */
         @SuppressWarnings("unchecked")
-        Catalog<String, Object, ServletWebContext> catalog =
-                (Catalog<String, Object, ServletWebContext>) context.get(getCatalogKey());
+        Catalog<String, Object, ServletWebContext<String, Object>> catalog =
+                (Catalog<String, Object, ServletWebContext<String, Object>>) context.get(getCatalogKey());
 
         if (catalog == null) {
             catalog = super.getCatalog(context);

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java Thu Jul 26 17:29:31 2012
@@ -29,7 +29,7 @@ import java.util.Locale;
  * @version $Id$
  */
 public class ServletGetLocaleCommand
-        extends AbstractGetLocaleCommand<ServletWebContext> {
+        extends AbstractGetLocaleCommand<ServletWebContext<String, Object>> {
 
     // ------------------------------------------------------- Protected Methods
 
@@ -39,7 +39,7 @@ public class ServletGetLocaleCommand
      * @param context The {@link Context} we are operating on.
      * @return The Locale for the request.
      */
-    protected Locale getLocale(ServletWebContext context) {
+    protected Locale getLocale(ServletWebContext<String, Object> context) {
         HttpServletRequest request = (HttpServletRequest)
             context.get("request");
         return (request.getLocale());

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java Thu Jul 26 17:29:31 2012
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletReq
  *
  * @version $Id$
  */
-public class ServletPathMapper extends LookupCommand<String, Object, ServletWebContext> {
+public class ServletPathMapper extends LookupCommand<String, Object, ServletWebContext<String, Object>> {
 
     // --------------------------------------------------------- Command Methods
 
@@ -48,7 +48,7 @@ public class ServletPathMapper extends L
      * @since Chain 1.2
      */
     @Override
-    protected String getCommandName(ServletWebContext swcontext) {
+    protected String getCommandName(ServletWebContext<String, Object> swcontext) {
         // Look up the servlet path for this request
         HttpServletRequest request = swcontext.getRequest();
         String servletPath = (String)
@@ -71,7 +71,8 @@ public class ServletPathMapper extends L
      * @since Chain 1.2
      */
     @Override
-    protected Catalog<String, Object, ServletWebContext> getCatalog(ServletWebContext context) {
+    protected Catalog<String, Object, ServletWebContext<String, Object>>
+            getCatalog(ServletWebContext<String, Object> context) {
         /* If the object returned from the passed context is not a valid catalog
          * then we use the super class's catalog extraction logic to pull it
          * or to error gracefully.
@@ -82,9 +83,10 @@ public class ServletPathMapper extends L
          * returning a catalog with the current context.
          */
         @SuppressWarnings("unchecked")
-        Catalog<String, Object, ServletWebContext> catalog = testCatalog != null && testCatalog instanceof Catalog ?
-                (Catalog<String, Object, ServletWebContext>) testCatalog :
-                super.getCatalog(context);
+        Catalog<String, Object, ServletWebContext<String, Object>> catalog =
+                testCatalog != null && testCatalog instanceof Catalog ?
+                    (Catalog<String, Object, ServletWebContext<String, Object>>) testCatalog :
+                    super.getCatalog(context);
 
         return catalog;
     }

Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java Thu Jul 26 17:29:31 2012
@@ -29,7 +29,7 @@ import java.util.Locale;
  * @version $Id$
  */
 public class ServletSetLocaleCommand
-        extends AbstractSetLocaleCommand<ServletWebContext> {
+        extends AbstractSetLocaleCommand<ServletWebContext<String, Object>> {
 
     // ------------------------------------------------------- Protected Methods
 
@@ -39,7 +39,7 @@ public class ServletSetLocaleCommand
      * @param context The {@link Context} we are operating on.
      * @param locale The Locale for the request.
      */
-    protected void setLocale(ServletWebContext context, Locale locale) {
+    protected void setLocale(ServletWebContext<String, Object> context, Locale locale) {
         HttpServletResponse response = (HttpServletResponse)
             context.get("response");
         response.setLocale(locale);

Added: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java?rev=1366094&view=auto
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java (added)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java Thu Jul 26 17:29:31 2012
@@ -0,0 +1,120 @@
+package org.apache.commons.chain2.web.servlet;
+
+import org.apache.commons.chain2.web.WebContext;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * @author Elijah Zupancic
+ * @since 1.0.0
+ */
+public interface ServletWebContext<K, V> extends WebContext<K, V> {
+    /**
+     * <p>Return the {@link javax.servlet.ServletContext} for this context.</p>
+     *
+     * @return The <code>ServletContext</code> for this context.
+     */
+    ServletContext getContext();
+
+    /**
+     * <p>Return the {@link javax.servlet.http.HttpServletRequest} for this context.</p>
+     *                     ServletWebContextBase
+     * @return The <code>HttpServletRequest</code> for this context.
+     */
+    HttpServletRequest getRequest();
+
+    /**
+     * <p>Return the {@link javax.servlet.http.HttpServletResponse} for this context.</p>
+     *
+     * @return The <code>HttpServletResponse</code> for this context.
+     */
+    HttpServletResponse getResponse();
+
+    /**
+     * <p>Initialize (or reinitialize) this {@link ServletWebContext} instance
+     * for the specified Servlet API objects.</p>
+     *
+     * @param context The <code>ServletContext</code> for this web application
+     * @param request The <code>HttpServletRequest</code> for this request
+     * @param response The <code>HttpServletResponse</code> for this request
+     */
+    void initialize(ServletContext context,
+                    HttpServletRequest request,
+                    HttpServletResponse response);
+
+    /**
+     * <p>Release references to allocated resources acquired in
+     * <code>initialize()</code> of via subsequent processing.  After this
+     * method is called, subsequent calls to any other method than
+     * <code>initialize()</code> will return undefined results.</p>
+     */
+    void release();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Application scope Map.
+     */
+    Map<String, Object> getApplicationScope();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Header values Map.
+     */
+    Map<String, String> getHeader();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Header values Map.
+     */
+    Map<String, String[]> getHeaderValues();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Initialization parameter Map.
+     */
+    Map<String, String> getInitParam();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Request parameter Map.
+     */
+    Map<String, String> getParam();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Request parameter Map.
+     */
+    Map<String, String[]> getParamValues();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Map of Cookies.
+     * @since Chain 1.1
+     */
+    Map<String, Cookie> getCookies();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Request scope Map.
+     */
+    Map<String, Object> getRequestScope();
+
+    /**
+     * See the {@link org.apache.commons.chain2.web.WebContext}'s Javadoc.
+     *
+     * @return Session scope Map.
+     */
+    Map<String, Object> getSessionScope();
+}

Copied: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java (from r1365837, commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java)
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java?p2=commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java&p1=commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java&r1=1365837&r2=1366094&rev=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java Thu Jul 26 17:29:31 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.chain2.web.servlet;
 
-import org.apache.commons.chain2.web.WebContext;
+import org.apache.commons.chain2.web.WebContextBase;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.Cookie;
@@ -25,36 +25,37 @@ import javax.servlet.http.HttpServletRes
 import java.util.Map;
 
 /**
- * <p>Concrete implementation of {@link WebContext} suitable for use in
+ * <p>Concrete implementation of {@link org.apache.commons.chain2.web.WebContext} suitable for use in
  * Servlets and JSP pages.  The abstract methods are mapped to the appropriate
  * collections of the underlying servlet context, request, and response
  * instances that are passed to the constructor (or the initialize method).</p>
  *
  * @version $Id$
  */
-public class ServletWebContext extends WebContext {
+public class ServletWebContextBase extends WebContextBase
+        implements ServletWebContext<String, Object> {
 
     private static final long serialVersionUID = 20120724L;
 
     // ------------------------------------------------------------ Constructors
 
     /**
-     * <p>Construct an uninitialized {@link ServletWebContext} instance.</p>
+     * <p>Construct an uninitialized {@link ServletWebContextBase} instance.</p>
      */
-    public ServletWebContext() {
+    public ServletWebContextBase() {
     }
 
     /**
-     * <p>Construct a {@link ServletWebContext} instance that is initialized
+     * <p>Construct a {@link ServletWebContextBase} instance that is initialized
      * with the specified Servlet API objects.</p>
      *
      * @param context The <code>ServletContext</code> for this web application
      * @param request The <code>HttpServletRequest</code> for this request
      * @param response The <code>HttpServletResponse</code> for this request
      */
-    public ServletWebContext(ServletContext context,
-                             HttpServletRequest request,
-                             HttpServletResponse response) {
+    public ServletWebContextBase(ServletContext context,
+                                 HttpServletRequest request,
+                                 HttpServletResponse response) {
         initialize(context, request, response);
     }
 
@@ -130,41 +131,18 @@ public class ServletWebContext extends W
 
     // ---------------------------------------------------------- Public Methods
 
-    /**
-     * <p>Return the {@link ServletContext} for this context.</p>
-     *
-     * @return The <code>ServletContext</code> for this context.
-     */
     public ServletContext getContext() {
         return (this.context);
     }
 
-    /**
-     * <p>Return the {@link HttpServletRequest} for this context.</p>
-     *
-     * @return The <code>HttpServletRequest</code> for this context.
-     */
     public HttpServletRequest getRequest() {
         return (this.request);
     }
 
-    /**
-     * <p>Return the {@link HttpServletResponse} for this context.</p>
-     *
-     * @return The <code>HttpServletResponse</code> for this context.
-     */
     public HttpServletResponse getResponse() {
         return (this.response);
     }
 
-    /**
-     * <p>Initialize (or reinitialize) this {@link ServletWebContext} instance
-     * for the specified Servlet API objects.</p>
-     *
-     * @param context The <code>ServletContext</code> for this web application
-     * @param request The <code>HttpServletRequest</code> for this request
-     * @param response The <code>HttpServletResponse</code> for this request
-     */
     public void initialize(ServletContext context,
                            HttpServletRequest request,
                            HttpServletResponse response) {
@@ -176,12 +154,6 @@ public class ServletWebContext extends W
         // Perform other setup as needed
     }
 
-    /**
-     * <p>Release references to allocated resources acquired in
-     * <code>initialize()</code> of via subsequent processing.  After this
-     * method is called, subsequent calls to any other method than
-     * <code>initialize()</code> will return undefined results.</p>
-     */
     public void release() {
         // Release references to allocated collections
         applicationScope = null;
@@ -200,13 +172,8 @@ public class ServletWebContext extends W
         response = null;
     }
 
-    // ------------------------------------------------------ WebContext Methods
+    // ------------------------------------------------------ WebContextBase Methods
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Application scope Map.
-     */
     public Map<String, Object> getApplicationScope() {
         if ((applicationScope == null) && (context != null)) {
             applicationScope = new ServletApplicationScopeMap(context);
@@ -214,11 +181,6 @@ public class ServletWebContext extends W
         return (applicationScope);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Header values Map.
-     */
     public Map<String, String> getHeader() {
         if ((header == null) && (request != null)) {
             header = new ServletHeaderMap(request);
@@ -226,11 +188,6 @@ public class ServletWebContext extends W
         return (header);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Header values Map.
-     */
     public Map<String, String[]> getHeaderValues() {
         if ((headerValues == null) && (request != null)) {
             headerValues = new ServletHeaderValuesMap(request);
@@ -238,11 +195,6 @@ public class ServletWebContext extends W
         return (headerValues);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Initialization parameter Map.
-     */
     public Map<String, String> getInitParam() {
         if ((initParam == null) && (context != null)) {
             initParam = new ServletInitParamMap(context);
@@ -250,11 +202,6 @@ public class ServletWebContext extends W
         return (initParam);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Request parameter Map.
-     */
     public Map<String, String> getParam() {
         if ((param == null) && (request != null)) {
             param = new ServletParamMap(request);
@@ -262,11 +209,6 @@ public class ServletWebContext extends W
         return (param);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Request parameter Map.
-     */
     public Map<String, String[]> getParamValues() {
         if ((paramValues == null) && (request != null)) {
             paramValues = new ServletParamValuesMap(request);
@@ -274,12 +216,6 @@ public class ServletWebContext extends W
         return (paramValues);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Map of Cookies.
-     * @since Chain 1.1
-     */
     public Map<String, Cookie> getCookies() {
         if ((cookieValues == null) && (request != null)) {
             cookieValues = new ServletCookieMap(request);
@@ -287,11 +223,6 @@ public class ServletWebContext extends W
         return (cookieValues);
     }
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Request scope Map.
-     */
     public Map<String, Object> getRequestScope() {
         if ((requestScope == null) && (request != null)) {
             requestScope = new ServletRequestScopeMap(request);
@@ -300,11 +231,6 @@ public class ServletWebContext extends W
     }
 
 
-    /**
-     * See the {@link WebContext}'s Javadoc.
-     *
-     * @return Session scope Map.
-     */
     public Map<String, Object> getSessionScope() {
         if ((sessionScope == null) && (request != null)) {
             sessionScope = new ServletSessionScopeMap(request);

Propchange: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContextBase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/ChainResourcesTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/ChainResourcesTestCase.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/ChainResourcesTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/ChainResourcesTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,18 +16,17 @@
  */
 package org.apache.commons.chain2.web;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.commons.chain2.web.ChainResources;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertNotNull;
+
 // Test case for org.apache.commons.chain2.web.ChainResources
 
 @RunWith(Parameterized.class)

Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,24 +16,17 @@
  */
 package org.apache.commons.chain2.web.portlet;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.portlet.PortletContext;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletResponse;
 import javax.portlet.PortletSession;
+import java.util.Locale;
 
-import org.apache.commons.chain2.web.portlet.PortletGetLocaleCommand;
-import org.apache.commons.chain2.web.portlet.PortletWebContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.*;
 
 
 // Test case for org.apache.commons.chain2.web.portlet.PortletGetLocaleCommand

Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletWebContextTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletWebContextTestCase.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletWebContextTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletWebContextTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.chain2.web.portlet;
 
-import static org.junit.Assert.*;
-
 import org.apache.commons.chain2.Context;
 import org.apache.commons.chain2.impl.ContextBaseTestCase;
 import org.apache.commons.chain2.web.WebContext;
@@ -30,13 +28,10 @@ import javax.portlet.PortletRequest;
 import javax.portlet.PortletResponse;
 import javax.portlet.PortletSession;
 import javax.servlet.http.Cookie;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Collection;
+
+import static org.junit.Assert.*;
 
 
 /**
@@ -107,7 +102,8 @@ public class PortletWebContextTestCase e
     @Test
     public void testApplicationScope() {
 
-        Map<String, Object> map = ((WebContext) context).getApplicationScope();
+        @SuppressWarnings("unchecked")
+        Map<String, Object> map = ((WebContext<String, Object>)context).getApplicationScope();
         assertNotNull(map);
 
         // Initial contents
@@ -198,7 +194,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testHeader() {
 
-        Map<String, String> map = ((WebContext) context).getHeader();
+        Map<String, String> map = ((WebContext<String, Object>) context).getHeader();
         assertNotNull("Header Map Null", map);
 
         // Initial contents
@@ -208,7 +204,7 @@ public class PortletWebContextTestCase e
             map.put("hkey3", "hvalue3");
             fail("Should have thrown UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
-            ; // expected result
+            // expected result
         }
 
     }
@@ -218,7 +214,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testHeaderValues() {
 
-        Map<String, String[]> map = ((WebContext) context).getHeaderValues();
+        Map<String, String[]> map = ((WebContext<String, Object>) context).getHeaderValues();
         assertNotNull("HeaderValues Map Null", map);
 
         // Initial contents
@@ -241,7 +237,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testInitParam() {
 
-        Map<String, String> map = ((WebContext) context).getInitParam();
+        Map<String, String> map = ((WebContext<String, Object>) context).getInitParam();
         assertNotNull(map);
 
         // Initial contents
@@ -292,7 +288,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testParam() {
 
-        Map<String, String> map = ((WebContext) context).getParam();
+        Map<String, String> map = ((WebContext<String, Object>) context).getParam();
         assertNotNull(map);
 
         // Initial contents
@@ -339,7 +335,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testParamValues() {
 
-        Map<String, String[]> map = ((WebContext) context).getParamValues();
+        Map<String, String[]> map = ((WebContext<String, Object>) context).getParamValues();
         assertNotNull(map);
 
         // Initial contents
@@ -395,7 +391,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testCookies() {
 
-        Map<String, Cookie> map = ((WebContext) context).getCookies();
+        Map<String, Cookie> map = ((WebContext<String, Object>) context).getCookies();
         assertNotNull(map);
 
         // Initial contents

Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ChainProcessorTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ChainProcessorTestCase.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ChainProcessorTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ChainProcessorTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,17 +16,15 @@
  */
 package org.apache.commons.chain2.web.servlet;
 
-import static org.junit.Assert.fail;
+import org.junit.Test;
 
+import javax.servlet.ServletConfig;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import javax.servlet.ServletConfig;
-
-import org.apache.commons.chain2.web.servlet.ChainProcessor;
-import org.junit.Test;
+import static org.junit.Assert.fail;
 
 /**
  *  Test case for {@link ChainProcessor}.

Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,24 +16,17 @@
  */
 package org.apache.commons.chain2.web.servlet;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import java.util.Locale;
 
-import org.apache.commons.chain2.web.servlet.ServletGetLocaleCommand;
-import org.apache.commons.chain2.web.servlet.ServletWebContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.*;
 
 
 // Test case for org.apache.commons.chain2.web.servlet.ServletGetLocaleCommand
@@ -53,7 +46,7 @@ public class ServletGetLocaleCommandTest
     protected HttpSession session = null;
 
     // Chain API Objects
-    protected ServletWebContext context = null;
+    protected ServletWebContext<String, Object> context = null;
     protected ServletGetLocaleCommand command = null;
 
 
@@ -78,7 +71,7 @@ public class ServletGetLocaleCommandTest
         response = new MockHttpServletResponse();
 
     // Set up Chain API Objects
-        context = new ServletWebContext(scontext, request, response);
+        context = new ServletWebContextBase(scontext, request, response);
     command = new ServletGetLocaleCommand();
 
     }

Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java?rev=1366094&r1=1366093&r2=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,23 +16,17 @@
  */
 package org.apache.commons.chain2.web.servlet;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import java.util.Locale;
 
-import org.apache.commons.chain2.web.servlet.ServletSetLocaleCommand;
-import org.apache.commons.chain2.web.servlet.ServletWebContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.*;
 
 
 // Test case for org.apache.commons.chain2.web.servlet.ServletSetLocaleCommand
@@ -52,7 +46,7 @@ public class ServletSetLocaleCommandTest
     protected HttpSession session = null;
 
     // Chain API Objects
-    protected ServletWebContext context = null;
+    protected ServletWebContextBase context = null;
     protected ServletSetLocaleCommand command = null;
 
 
@@ -76,7 +70,7 @@ public class ServletSetLocaleCommandTest
         response = new MockHttpServletResponse();
 
     // Set up Chain API Objects
-        context = new ServletWebContext(scontext, request, response);
+        context = new ServletWebContextBase(scontext, request, response);
     command = new ServletSetLocaleCommand();
 
     }
@@ -126,22 +120,20 @@ public class ServletSetLocaleCommandTest
     // --------------------------------------------------------- Support Methods
 
 
-    protected void check(ServletWebContext context, ServletSetLocaleCommand command)
-    throws Exception {
-
-    String localeKey = command.getLocaleKey();
-    assertNotNull(localeKey);
-    Object value = context.get(localeKey);
-    assertNull(value);
-    context.put(localeKey, locale);
-    assertNotNull(context.get(localeKey));
-    assertNull(response.getLocale());
-    boolean result = command.execute(context);
-    assertFalse(result);
-    assertNotNull(response.getLocale());
-    assertEquals(locale, response.getLocale());
+    protected void check(ServletWebContextBase context, ServletSetLocaleCommand command)
+            throws Exception {
 
+        String localeKey = command.getLocaleKey();
+        assertNotNull(localeKey);
+        Object value = context.get(localeKey);
+        assertNull(value);
+        context.put(localeKey, locale);
+        assertNotNull(context.get(localeKey));
+        assertNull(response.getLocale());
+        boolean result = command.execute(context);
+        assertFalse(result);
+        assertNotNull(response.getLocale());
+        assertEquals(locale, response.getLocale());
     }
 
-
 }

Copied: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java (from r1365837, commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextTestCase.java)
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java?p2=commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java&p1=commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextTestCase.java&r1=1365837&r2=1366094&rev=1366094&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextTestCase.java (original)
+++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java Thu Jul 26 17:29:31 2012
@@ -16,32 +16,22 @@
  */
 package org.apache.commons.chain2.web.servlet;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
+import org.apache.commons.chain2.Context;
+import org.apache.commons.chain2.impl.ContextBaseTestCase;
+import org.apache.commons.chain2.web.WebContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import java.util.*;
+import java.util.Map.Entry;
 
-import org.apache.commons.chain2.Context;
-import org.apache.commons.chain2.impl.ContextBaseTestCase;
-import org.apache.commons.chain2.web.WebContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.*;
 
 
 /**
@@ -49,7 +39,7 @@ import org.junit.Test;
  * extra functionality of this implementation.
  */
 
-public class ServletWebContextTestCase extends ContextBaseTestCase {
+public class ServletWebContextBaseTestCase extends ContextBaseTestCase {
 
 
     // ----------------------------------------------------- Instance Variables
@@ -183,14 +173,14 @@ public class ServletWebContextTestCase e
     @Test
     public void testEquals() {
 
-        // FIXME - ServletWebContext needs a better equals()
+        // FIXME - ServletWebContextBase needs a better equals()
 
         // Compare to self
         assertTrue(context.equals(context));
         assertTrue(context.hashCode() == context.hashCode());
 
         // Compare to equivalent instance
-        Context<String, Object> other = new ServletWebContext(scontext, request, response);
+        Context<String, Object> other = new ServletWebContextBase(scontext, request, response);
         // assertTrue(context.equals(other));
         assertTrue(context.hashCode() == other.hashCode());
 
@@ -200,7 +190,7 @@ public class ServletWebContextTestCase e
         assertTrue(context.hashCode() != other.hashCode());
 
         // Compare to non-equivalent instance - self modified
-        other = new ServletWebContext(scontext, request, response);
+        other = new ServletWebContextBase(scontext, request, response);
         context.put("bop", "bop value");
         // assertTrue(!context.equals(other));
         assertTrue(context.hashCode() != other.hashCode());
@@ -212,7 +202,8 @@ public class ServletWebContextTestCase e
     @Test
     public void testHeader() {
 
-        Map<String, String> map = ((WebContext) context).getHeader();
+        @SuppressWarnings("unchecked")
+        Map<String, String> map = ((WebContext<String, Object>) context).getHeader();
         assertNotNull(map);
 
         // Initial contents
@@ -721,7 +712,7 @@ public class ServletWebContextTestCase e
     public void testSessionScopeWithoutSession() {
 
         // Create a Context without a session
-        ServletWebContext ctx = new ServletWebContext(scontext,
+        ServletWebContext<String, Object> ctx = new ServletWebContextBase(scontext,
            new MockHttpServletRequest(), response);
         assertNull("Session(A)", ctx.getRequest().getSession(false));
 
@@ -848,7 +839,7 @@ public class ServletWebContextTestCase e
 
     // Create a new instance of the appropriate Context type for this test case
     protected Context<String, Object> createContext() {
-        return (new ServletWebContext(scontext, request, response));
+        return (new ServletWebContextBase(scontext, request, response));
     }
 
 

Propchange: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletWebContextBaseTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message