cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: rev 55023 - in cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon: components/treeprocessor environment/wrapper
Date Mon, 18 Oct 2004 17:24:18 GMT
Author: unico
Date: Mon Oct 18 10:24:18 2004
New Revision: 55023

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
Log:
add a flag to the wrapper environment telling it whether to wrap the response or not
because forwarding redirects from the treeprocessor must not be handled with a wrapped response

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Mon Oct 18 10:24:18 2004
@@ -361,7 +361,7 @@
         public ForwardEnvironmentWrapper(Environment env,
             ComponentManager manager, String uri, Logger logger) 
         throws MalformedURLException {
-            super(env, manager, uri, logger);
+            super(env, manager, uri, logger, false);
         }
 
         public void setStatus(int statusCode) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
Mon Oct 18 10:24:18 2004
@@ -110,7 +110,7 @@
                               ComponentManager manager,
                               boolean          rawMode)
     throws MalformedURLException {
-        this(env, requestURI, queryString, logger, null, rawMode,env.getView());
+        this(env, requestURI, queryString, logger, null, rawMode,env.getView(), true);
     }
     
     /**
@@ -125,17 +125,34 @@
                               boolean          rawMode,
                               String           view)
     throws MalformedURLException {
-        super(env.getURI(), view, env.getContext(), env.getAction());
-        init(env, requestURI, queryString, logger, manager, rawMode, view);
+        this(env, requestURI, queryString, logger, manager, rawMode, view, true);
     }
 
-    private void init(Environment      env,
+    /**
+     * Constructs an EnvironmentWrapper object from a Request
+     * and Response objects
+     */
+    public EnvironmentWrapper(Environment      env,
                               String           requestURI,
                               String           queryString,
                               Logger           logger,
                               ComponentManager manager,
                               boolean          rawMode,
-                              String           view)
+                              String           view,
+                              boolean          wrapResponse)
+    throws MalformedURLException {
+        super(env.getURI(), view, env.getContext(), env.getAction());
+        init(env, requestURI, queryString, logger, manager, rawMode, view, wrapResponse);
+    }
+
+    private void init(Environment      env,
+                      String           requestURI,
+                      String           queryString,
+                      Logger           logger,
+                      ComponentManager manager,
+                      boolean          rawMode,
+                      String           view,
+                      boolean          wrapResponse)
         throws MalformedURLException {
 //        super(env.getURI(), view, env.getContext(), env.getAction());
         this.rootContext = env.getRootContext();
@@ -164,13 +181,14 @@
                                           queryString,
                                           this,
                                           rawMode);
-        Response response = new ResponseWrapper(ObjectModelHelper.getResponse(oldObjectModel));
         this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, this.request);
-        this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, response);
-        
+        if (wrapResponse) {
+            Response response = new ResponseWrapper(ObjectModelHelper.getResponse(oldObjectModel));
+            this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, response);
+        }
     }
    
-    public EnvironmentWrapper(Environment env, ComponentManager manager, String uri,  Logger
logger)  throws MalformedURLException {
+    public EnvironmentWrapper(Environment env, ComponentManager manager, String uri,  Logger
logger, boolean wrapResponse)  throws MalformedURLException {
         super(env.getURI(), env.getView(), env.getContext(), env.getAction());
 
         // FIXME(SW): code stolen from SitemapSource. Factorize somewhere...
@@ -249,7 +267,7 @@
 //            this.protocol + "://" + requestURI :
 //            this.protocol + "://" + requestURI + "?" + queryString;
 
-        this.init(env, requestURI, queryString, logger, manager, rawMode, view);
+        this.init(env, requestURI, queryString, logger, manager, rawMode, view, wrapResponse);
         this.setURI(prefix, uri);
         
     }

Mime
View raw message