You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2004/11/24 20:25:20 UTC

svn commit: r106447 - in struts/sandbox/trunk/struts-shale: . src/conf src/java/org/apache/shale/faces

Author: craigmcc
Date: Wed Nov 24 11:25:18 2004
New Revision: 106447

URL: http://svn.apache.org/viewcvs?view=rev&rev=106447
Log:
Implement the mechanism for application-wide controller actions (as described
in the original Shale proposal), by virtue of turning the filter's processing
into the execution of a Commons Chain chain.  The standard behavior can be
customized in two different ways:

* You can completely replace the "standard" command in the "shale" catalog
  with something of your own devising.  Note that you'll likely want to use
  something like the InvokeCommand command included in the standard chain
  to invoke the remainder of the servlet container's filter chain.

* You can define your own "preprocess" and/or "postprocess" commands in the
  "shale" catalog, which will be invoked before, or after, the remainder of
  the servlet container's filter chain, respectively.  If you have commands
  in the preprocess chain, you can do things like an HTTP redirect and then
  return true (which tells Commons Chain that the request has been completely
  processed), so that all remaining activities will be skipped.

As Shale initializes itself, it determines whether the application has already
set up a "standard" command in the "shale" catalog.  If not, it configures this
command based on a "shale-config.xml" file embedded in the JAR.  This does not
require any extra configuration work by the application developer.

Added:
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml
Modified:
   struts/sandbox/trunk/struts-shale/build.properties.sample
   struts/sandbox/trunk/struts-shale/build.xml
   struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java

Modified: struts/sandbox/trunk/struts-shale/build.properties.sample
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/build.properties.sample?view=diff&rev=106447&p1=struts/sandbox/trunk/struts-shale/build.properties.sample&r1=106446&p2=struts/sandbox/trunk/struts-shale/build.properties.sample&r2=106447
==============================================================================
--- struts/sandbox/trunk/struts-shale/build.properties.sample	(original)
+++ struts/sandbox/trunk/struts-shale/build.properties.sample	Wed Nov 24 11:25:18 2004
@@ -25,6 +25,22 @@
 # $Id:  $
 #
 
+# The absolute or relative pathname of the directory containing the
+# Jakarta Commons BeanUtils library
+beanutils.home = /usr/local/commons-beanutils-1.7
+
+# The absolute or relative pathname of the directory containing the
+# Jakarta Commons Chain library
+chain.home = /usr/local/commons-chain-1.0
+
+# The absolute or relative pathname of the directory containing the
+# Jakarta Commons Digester library
+digester.home = /usr/local/commons-digester-1.6
+
+# The absolute or relative pathname of the directory containing the
+# Jakarta Commons Logging library
+logging.home = /usr/local/commons-logging-1.0.4
+
 # The absolute or relative pathname of the directory containing your
 # Servlet API classes JAR file (servlet.jar)
 server.home = /usr/local/jakarta-tomcat-5.0.28

Modified: struts/sandbox/trunk/struts-shale/build.xml
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/build.xml?view=diff&rev=106447&p1=struts/sandbox/trunk/struts-shale/build.xml&r1=106446&p2=struts/sandbox/trunk/struts-shale/build.xml&r2=106447
==============================================================================
--- struts/sandbox/trunk/struts-shale/build.xml	(original)
+++ struts/sandbox/trunk/struts-shale/build.xml	Wed Nov 24 11:25:18 2004
@@ -33,34 +33,39 @@
 
 
   <!-- Dependency home directory defaults -->
+  <property name="beanutils.home"   value="/usr/local/commons-beanutils-1.7.0"/>
+  <property name="chain.home"       value="/usr/local/commons-chain-1.0"/>
+  <property name="digester.home"    value="/usr/local/commons-digester-1.6"/>
   <property name="jsf.home"         value="/usr/local/jsf-1_1_01"/>
   <property name="junit.home"       value="/usr/local/junit-3.8.1"/>
+  <property name="logging.home"     value="/usr/local/commons-logging-1.0.4"/>
   <property name="server.home"      value="/usr/local/jakarta-tomcat-5.0.28"/>
+  <property name="shale-test.home"  value="${basedir}/../struts-shale-test/dist"/>
 
 
   <!-- Dependency library defaults -->
-<!--
   <property name="commons-beanutils.jar"
-                                    value="${struts.home}/lib/commons-beanutils.jar"/>
-  <property name="commons-collections.jar"
-                                    value="${struts.home}/lib/commons-collections.jar"/>
+                                    value="${beanutils.home}/commons-beanutils.jar"/>
+  <property name="commons-chain.jar"
+                                    value="${chain.home}/commons-chain.jar"/>
   <property name="commons-digester.jar"
-                                    value="${struts.home}/lib/commons-digester.jar"/>
+                                    value="${digester.home}/commons-digester.jar"/>
+<!--
   <property name="commons-fileupload.jar"
                                     value="${struts.home}/lib/commons-fileupload.jar"/>
 -->
   <property name="commons-logging.jar"
-                                    value="${struts.home}/lib/commons-logging.jar"/>
+                                    value="${logging.home}/commons-logging.jar"/>
 <!--
   <property name="commons-validator.jar"
                                     value="${struts.home}/lib/commons-validator.jar"/>
-  <property name="jakarta-oro.jar"  value="${struts.home}/lib/jakarta-oro.jar"/>
 -->
   <property name="jsf-api.jar"      value="${jsf.home}/lib/jsf-api.jar"/>
   <property name="jsf-impl.jar"     value="${jsf.home}/lib/jsf-impl.jar"/>
   <property name="jsp-api.jar"      value="${server.home}/common/lib/jsp-api.jar"/>
   <property name="junit.jar"        value="${junit.home}/junit.jar"/>
   <property name="servlet-api.jar"  value="${server.home}/common/lib/servlet-api.jar"/>
+  <property name="shale-test.jar"   value="${shale-test.home}/lib/shale-test.jar"/>
 
 
   <!-- Conditional Processing Flags -->
@@ -94,10 +99,11 @@
 
   <!-- Compile Classpath -->
   <path id="compile.classpath">
-<!--
     <pathelement location="${commons-beanutils.jar}"/>
-    <pathelement location="${commons-collections.jar}"/>
+    <pathelement location="${commons-chain.jar}"/>
     <pathelement location="${commons-digester.jar}"/>
+<!--
+    <pathelement location="${commons-fileupload.jar}"/>
 -->
     <pathelement location="${commons-logging.jar}"/>
 <!--
@@ -112,10 +118,11 @@
 
   <!-- Test Classpath -->
   <path id="test.classpath">
-<!--
     <pathelement location="${commons-beanutils.jar}"/>
-    <pathelement location="${commons-collections.jar}"/>
+    <pathelement location="${commons-chain.jar}"/>
     <pathelement location="${commons-digester.jar}"/>
+<!--
+    <pathelement location="${commons-fileupload.jar}"/>
 -->
     <pathelement location="${commons-logging.jar}"/>
 <!--
@@ -125,10 +132,12 @@
     <pathelement location="${jsp-api.jar}"/>
     <pathelement location="${junit.jar}"/>
     <pathelement location="${servlet-api.jar}"/>
+    <pathelement location="${shale-test.jar}"/>
     <pathelement location="${build.home}/classes"/>
     <pathelement location="${build.home}/test-classes"/>
   </path>
 
+
   <!-- ==================== Maintenance Targets ============================ -->
 
 
@@ -145,8 +154,14 @@
     <filter  token="package"  value="${project.package}"/>
     <filter  token="state"    value="${systest.state.saving}"/>
     <filter  token="version"  value="${project.version}"/>
-    <echo  message="jsf-api.jar =    ${jsf-api.jar}"/>
-    <echo  message="jsf-impl.jar =   ${jsf-impl.jar}"/>
+    <echo  message="commons-beanutils.jar =  ${commons-beanutils.jar}"/>
+    <echo  message="commons-chain.jar =      ${commons-chain.jar}"/>
+    <echo  message="commons-digester.jar =   ${commons-digester.jar}"/>
+    <echo  message="commons-logging.jar =    ${commons-logging.jar}"/>
+    <echo  message="jsf-api.jar =            ${jsf-api.jar}"/>
+    <echo  message="jsf-impl.jar =           ${jsf-impl.jar}"/>
+    <echo  message="jsp-api.jar =            ${jsp-api.jar}"/>
+    <echo  message="servlet-api.jar =        ${servlet-api.jar}"/>
     <echo  message="jsfri.present =  ${jsfri.present}"/>
     <echo  message="myfaces.present= ${myfaces.present}"/>
   </target>

Modified: struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml?view=diff&rev=106447&p1=struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml&r1=106446&p2=struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml&r2=106447
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml	(original)
+++ struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml	Wed Nov 24 11:25:18 2004
@@ -2,7 +2,7 @@
 
 
 <!DOCTYPE faces-config PUBLIC
-  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
   "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
 
 

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java?view=auto&rev=106447
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java	Wed Nov 24 11:25:18 2004
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shale.faces;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+
+/**
+ * <p>Standard Chain of Responsibility command to invoke the remainder of the
+ * web container's filter chain, using the currently specified request and
+ * response objects.</p>
+ *
+ * $Id$
+ */
+public class InvokeCommand implements Command {
+    
+    
+    /**
+     * <p>Invoke the remainder of the filter chain.</p>
+     *
+     * @param context <code>ShaleWebContext</code> for this request
+     */
+    public boolean execute(Context context) throws Exception {
+
+        ShaleWebContext webContext = (ShaleWebContext) context;
+        webContext.getChain().doFilter(webContext.getRequest(),
+                                       webContext.getResponse());
+        return false;
+
+    }
+
+
+}

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java?view=diff&rev=106447&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java&r1=106446&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java&r2=106447
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java	Wed Nov 24 11:25:18 2004
@@ -16,17 +16,29 @@
 
 package org.apache.shale.faces;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.shale.view.DefaultViewControllerMapper;
-
+import java.io.IOException;
+import java.net.URL;
 import javax.faces.FactoryFinder;
 import javax.faces.event.PhaseListener;
 import javax.faces.lifecycle.Lifecycle;
 import javax.faces.lifecycle.LifecycleFactory;
-import javax.servlet.*;
-import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.config.ConfigParser;
+import org.apache.commons.chain.impl.CatalogBase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.view.DefaultViewControllerMapper;
 
 /**
  * <p>{@link ShaleApplicationFilter} is a <code>Filter</code> implementation
@@ -35,6 +47,46 @@
  * In addition, it performs overall application startup and shutdown
  * operations on behalf of the framework.</p>
  *
+ * <p>The detailed processing to be performed for each request is configured
+ * by a <code>Command</code> or <code>Chain</code> defined using the "Chain of
+ * Resposibility" design pattern, as implemented by the Commons Chain package.
+ * There must exist a <code>Catalog</code> named <code>shale</code>, which
+ * contains a <code>Command</code> named <code>standard</code>, that defines
+ * the processing to be performed.</p>
+ *
+ * <p>At any point, one of the <code>Command</code>s being executed may choose
+ * to complete the response itself (such as to perform an HTTP redirect),
+ * instead of allowing processing to continue.  To indicate this choice, the
+ * <code>Command</code> should follow the standard Commons Chain convention of
+ * returning <code>true</code>.  If you want processing to continue, return
+ * <code>false</code> instead.</p>
+ *
+ * <p>The default implementation of the standard command processing chain
+ * performs the following tasks:</p>
+ * <ul>
+ * <li>Invoke a command named <code>preprocess</code> (in the <code>shale</code>
+ *     catalog), if it exists.  This is where you should insert commands to be
+ *     executed <strong>before</code> {@link ShaleApplicationFilter} passes the
+ *     request on to the next filter or servlet.</li>
+ * <li>Execute the remainder of the filter chain for this request.</li>
+ * <li>Invokes a command named <code>postprocess</code> (in the <code>shale</code>
+ *     catalog), if it exists.  This is where you should insert commands to be
+ *     executed <strong>after</code> control returns from the invoked filter or
+ *     servlet.  Note that it is no longer possible, at this point, to replace
+ *     the response content produced by the filter or servlet -- that should
+ *     be done in a preprocess step.</li>
+ * </ul>
+ *
+ * <p><strong>NOTE</strong> - Configuration of the <code>shale</code> catalog,
+ * and the commands it contains, may be performed in any manner you desire.
+ * One convenient mechanism is to use the <code>ChainListener</code> class
+ * that is included in the Commons Chain package.  If you do not reconfigure it
+ * differently, the <code>standard</code> command (in the <code>shale</code>
+ * catalog) will be configured according to the embedded resource
+ * <code>org/apache/shale/faces/shale-config.xml</code> in the JAR file
+ * containing the core Shale runtime environment, which executes the default
+ * request processing described above.</p>
+ *
  * $Id$
  */
 
@@ -45,6 +97,37 @@
 
 
     /**
+     * <p>The name of the Commons Chain <code>Catalog</code> to use.</p>
+     */
+    public static final String CATALOG_NAME = "shale";
+
+
+    /**
+     * <p>The name of the <code>Command</code> (in the <code>Catalog</code>
+     * named by <code>CATALOG_NAME</code>) that performs the standard
+     * application scope request processing.</p>
+     */
+    public static final String COMMAND_NAME = "standard";
+
+
+    /**
+     * <p>The request scope attribute key under which the <code>Context</code>
+     * object used for this chain of command request to be stored, in addition
+     * to it being passed in to the command chains.</p>
+     */
+    public static final String CONTEXT_ATTR =
+      "org.apache.shale.CONTEXT_ATTR";
+
+
+    /**
+     * <p>The name of the internal resource containing our default
+     * configuration of the default command.</p>
+     */
+    public static final String RESOURCE_NAME =
+      "org/apache/shale/faces/shale-config.xml";
+
+
+    /**
      * <p>The <code>Log</code> instance for this class.</p>
      */
     private static final Log log =
@@ -55,6 +138,12 @@
 
 
     /**
+     * <p>Chain of Responsibility <code>Catalog</code> we will be using.</p>
+     */
+    private Catalog catalog = null;
+
+
+    /**
      * <p>Filter configuration object for this <code>Filter</code>.</p>
      */
     private FilterConfig config = null;
@@ -88,6 +177,7 @@
         phaseListener = null;
         context = null;
         config = null;
+        catalog = null;
 
     }
     
@@ -102,9 +192,27 @@
     public void doFilter(ServletRequest request, ServletResponse response,
       FilterChain chain) throws IOException, ServletException {
 
-        ; // FIXME - do any required preprocessing
-        chain.doFilter(request, response);
-        ; // FIXME - do any required postprocessing
+      // Construct and store a new Context for this request
+      ShaleWebContext context =
+        new ShaleWebContext(this.context,
+          (HttpServletRequest) request,
+          (HttpServletResponse) response, chain);
+      request.setAttribute(CONTEXT_ATTR, context);
+
+      // Invoke the standard processing command on this context
+      Command standard = catalog.getCommand(COMMAND_NAME);
+      try {
+          standard.execute(context);
+      } catch (IOException e) {
+          throw e;
+      } catch (ServletException e) {
+          throw e;
+      } catch (Exception e) {
+          throw new ServletException(e);
+      }
+
+      // Clean up the stored request attribute
+      request.removeAttribute(CONTEXT_ATTR);
 
     }
 
@@ -126,10 +234,62 @@
         context.setAttribute(ShaleConstants.VIEW_MAPPER,
           new DefaultViewControllerMapper());
 
+        // Look up the "shale" catalog and ensure "standard" is defined
+        try {
+            this.catalog = getCatalog();
+        } catch (ServletException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+
     }
 
 
     // --------------------------------------------------------- Private Methods
+
+
+    /**
+     * <p>Return the "shale" catalog with a "standard" command, configuring the
+     * default version of this command if necessary.</p>
+     *
+     * @exception Exception if a resource parsing exception occurs
+     */
+    private Catalog getCatalog() throws Exception {
+
+        // Look up the "shale" catalog, creating one if necessary
+        Catalog catalog = CatalogFactory.getInstance().getCatalog(CATALOG_NAME);
+        if (catalog == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Creating catalog '" + CATALOG_NAME + "'");
+            }
+            catalog = new CatalogBase();
+            CatalogFactory.getInstance().addCatalog(CATALOG_NAME, catalog);
+        }
+
+        // If the required command exists, just return the catalog
+        if (catalog.getCommand(COMMAND_NAME) != null) {
+            return catalog;
+        }
+
+        // Configure based on our default resource
+        if (log.isDebugEnabled()) {
+            log.debug("Parsing default resource '" + RESOURCE_NAME + "'");
+        }
+        ConfigParser parser = new ConfigParser();
+        URL url = this.getClass().getClassLoader().getResource(RESOURCE_NAME);
+        if (url == null) {
+            throw new IllegalArgumentException(RESOURCE_NAME);
+        }
+        parser.parse(url);
+
+        // Ensure that the required command has been configured
+        if (catalog.getCommand(COMMAND_NAME) == null) {
+            throw new IllegalArgumentException(COMMAND_NAME);
+        }
+        return catalog;
+
+    }
 
 
     /**

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java?view=auto&rev=106447
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java	Wed Nov 24 11:25:18 2004
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.faces;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import org.apache.commons.chain.web.servlet.ServletWebContext;
+
+/**
+ * <p>Commons Chain <code>Context</code> implementation for Shale.</p>
+ */
+public class ShaleWebContext extends ServletWebContext {
+
+
+    // ------------------------------------------------------------ Constructors
+
+
+    /**
+     * <p>Construct a new context instance with the specified parameters.
+     *
+     * @param context <code>ServletContext</code> for this application
+     * @param request <code>HttpServetRewquest</code> for this request
+     * @param response <code>HttpServletResponse</code> for this request
+     * @param chain <code>FilterChain</code> for this request
+     */
+    public ShaleWebContext(ServletContext context,
+                           HttpServletRequest request,
+                           HttpServletResponse response,
+                           FilterChain chain) {
+
+        super(context, request, response);
+        this.chain = chain;
+
+    }
+    
+
+    // ------------------------------------------------------ Instance Variables
+
+
+    /**
+     * <p>The <code>FilterChain</code> for the current request.
+     */
+    private FilterChain chain = null;
+
+
+    /**
+     * <p>The <code>FacesContext</code> for the current request (if any).</p>
+     */
+    private FacesContext facesContext = null;
+
+
+    // -------------------------------------------------------------- Properties
+
+
+    /**
+     * <p>Return the <code>FilterChain</code> for the current request.</p>
+     */
+    public FilterChain getChain() {
+        return this.chain;
+    }
+
+
+    /**
+     * <p>Return the <code>FacesContext</code> for the current request, if any;
+     * otherwise, return <code>null</code>.</p>
+     */
+    public FacesContext getFacesContext() {
+        return this.facesContext;
+    }
+
+
+    /**
+     * <p>Set the <code>FacesContext</code> for the current request.  This
+     * method should only be called by the framework, once it is determined
+     * that this is actually a JSF request.</p>
+     *
+     * @param facesContext The <code>FacesContext</code> for this request
+     */
+    public void setFacesContext(FacesContext facesContext) {
+        this.facesContext = facesContext;
+    }
+
+
+    /**
+     * <p>Set the <code>HttpServletRequest</code> that will be passed on to the
+     * remainder of the filter chain.  If this is different from the request
+     * originally used to create this context, it must be an implementation of
+     * <code>HttpServletRequestWrapper</code> that wraps the original request.</p>
+     *
+     * <p><strong>NOTE</strong> - Setting ths property is only useful if it
+     * occurs in the preprocessing portion of the chain, before the filter
+     * chain has been invoked.</p>
+     *
+     * @param request The request or request wrapper to pass on
+     */
+    public void setRequest(HttpServletRequest request) {
+        if (!(request instanceof HttpServletRequestWrapper)) {
+            // FIXME - i18n
+            throw new IllegalArgumentException("Must be an HttpServletRequestWrapper");
+        }
+        initialize(getContext(), request, getResponse());
+    }
+
+
+    /**
+     * <p>Set the <code>HttpServletResponse</code> that will be passed on to the
+     * remainder of the filter chain.  If this is different from the response
+     * originally used to create this context, it must be an implementation of
+     * <code>HttpServletResponseWrapper</code> that wraps the original request.</p>
+     *
+     * <p><strong>NOTE</strong> - Setting ths property is only useful if it
+     * occurs in the preprocessing portion of the chain, before the filter
+     * chain has been invoked.</p>
+     *
+     * @param response The response or response wrapper to pass on
+     */
+    public void setResponse(HttpServletResponse response) {
+        if (!(response instanceof HttpServletResponseWrapper)) {
+            // FIXME - i18n
+            throw new IllegalArgumentException("Must be an HttpServletResponseWrapper");
+        }
+        initialize(getContext(), getRequest(), response);
+    }
+
+
+}

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml?view=auto&rev=106447
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml	Wed Nov 24 11:25:18 2004
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+  Copyright 2004 The Apache Software Foundation.
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+  $Id: build.xml 54942 2004-10-16 22:39:25Z craigmcc $
+
+-->
+
+<!--
+
+  This configuration file defines the default Chain of Command configuration
+  for a Catalog named "shale", which is in turn utilized by a filter
+  (ShaleApplicationFilter) to perform application level controller
+  functionality on every request.  You may customize these chains either
+  by replacing this configuration file with a different one, or by populating
+  your own versions of these commands in the "shale" catalog.
+
+-->
+
+<catalog           name="shale">
+
+
+  <!-- ================ Perform Dispatch Processing ======================== -->
+
+  <chain           name="standard">
+
+    <!-- Invoke "preprocess" command if it exists -->
+    <command  className="org.apache.commons.chain.generic.LookupCommand"
+            catalogName="shale"
+                   name="preprocess"
+               optional="true"/>
+
+    <!-- Invoke the remainder of the filter chain -->
+    <command  className="org.apache.shale.faces.InvokeCommand"/>
+
+    <!-- Invoke "postprocess" command if it exists -->
+    <command  className="org.apache.commons.chain.generic.LookupCommand"
+            catalogName="shale"
+                   name="postprocess"
+               optional="true"/>
+
+  </chain>
+
+
+</catalog>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org