cocoon-cvs mailing list archives

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

Modified:
   cocoon/trunk/src/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java
   cocoon/trunk/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/trunk/src/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java
(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java
Mon Oct 18 10:24:05 2004
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.environment.internal;
 
-import java.io.IOException;
 import java.net.MalformedURLException;
 
 import org.apache.avalon.framework.logger.Logger;
@@ -35,7 +34,7 @@
                                      SitemapSourceInfo info, 
                                      Logger logger) 
     throws MalformedURLException {
-        super(env, info, logger);
+        super(env, info, logger, false);
     }
 
     /* (non-Javadoc)

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java	Mon
Oct 18 10:24:05 2004
@@ -60,7 +60,8 @@
     protected boolean internalRedirect = false;
     
     /**
-     * Construct a new environment
+     * Construct a new environment.
+     * 
      * @param env    The origial Environment
      * @param info   A description of the uri for the new environment
      * @param logger The logger to be used by this environment
@@ -68,6 +69,21 @@
     public EnvironmentWrapper(Environment       env,
                               SitemapSourceInfo info,
                               Logger            logger) {
+        this(env, info, logger, true);
+    }
+
+    /**
+     * Construct a new environment.
+     * 
+     * @param env    The origial Environment
+     * @param info   A description of the uri for the new environment
+     * @param logger The logger to be used by this environment
+     * @param wrapResponse  Whether or not to wrap the Response object
+     */
+    public EnvironmentWrapper(Environment       env,
+                              SitemapSourceInfo info,
+                              Logger            logger,
+                              boolean           wrapResponse) {
         super(env.getURI(), info.view, env.getAction());
         
         this.enableLogging(logger);
@@ -91,9 +107,12 @@
                                           info.queryString,
                                           this,
                                           info.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);
+        }
 
         this.setURI(info.prefix, info.uri);        
     }

Mime
View raw message