cziegeler 2004/03/18 07:15:10
Modified: src/java/org/apache/cocoon/environment Environment.java
AbstractEnvironment.java
src/test/org/apache/cocoon/environment/mock
MockEnvironment.java
src/java/org/apache/cocoon/environment/wrapper
EnvironmentWrapper.java
MutableEnvironmentFacade.java
src/java/org/apache/cocoon/components/cprocessor/sitemap/impl
PipelineNode.java
src/java/org/apache/cocoon/components/cprocessor
TreeProcessor.java
Log:
Better solution for the new internal redirect handling
Revision Changes Path
1.14 +12 -5
cocoon-2.2/src/java/org/apache/cocoon/environment/Environment.java
Index: Environment.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/Environment.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Environment.java 8 Mar 2004 14:02:43 -0000 1.13
+++ Environment.java 18 Mar 2004 15:15:09 -0000 1.14
@@ -176,12 +176,19 @@
void finishingProcessing();
/**
- * Is this environment external ? An external environment is one that is
created in response
- * to an external request (http, commandline, etc.). Environments
created by the "cocoon:"
- * protocol aren't external.
+ * Is this environment external ? An external environment is one that
+ * is created in response to an external request (http, commandline,
etc.).
+ * Environments created by the "cocoon:" protocol aren't external.
*
- * @return true is this environment is external
+ * @return true if this environment is external
*/
boolean isExternal();
+
+ /**
+ * Is this an internal redirect?
+ * An environment is on internal redirect if it is an internal request
+ * (via the cocoon: protocol) and used for a redirect.
+ */
+ boolean isInternalRedirect();
}
1.26 +8 -1
cocoon-2.2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- AbstractEnvironment.java 8 Mar 2004 14:02:42 -0000 1.25
+++ AbstractEnvironment.java 18 Mar 2004 15:15:09 -0000 1.26
@@ -277,4 +277,11 @@
public void finishingProcessing() {
// do nothing here
}
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.environment.Environment#isInternRedirect()
+ */
+ public boolean isInternalRedirect() {
+ return false;
+ }
}
1.9 +6 -0
cocoon-2.2/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java
Index: MockEnvironment.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MockEnvironment.java 8 Mar 2004 14:04:20 -0000 1.8
+++ MockEnvironment.java 18 Mar 2004 15:15:10 -0000 1.9
@@ -153,5 +153,11 @@
return true;
}
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.environment.Environment#isInternalRedirect()
+ */
+ public boolean isInternalRedirect() {
+ return false;
+ }
}
1.20 +12 -5
cocoon-2.2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
Index: EnvironmentWrapper.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- EnvironmentWrapper.java 11 Mar 2004 14:48:29 -0000 1.19
+++ EnvironmentWrapper.java 18 Mar 2004 15:15:10 -0000 1.20
@@ -62,7 +62,7 @@
protected String contentType;
- protected boolean external = false;
+ protected boolean internalRedirect = false;
/**
* Constructs an EnvironmentWrapper object from a Request
@@ -281,13 +281,20 @@
* Always return <code>false</code>.
*/
public boolean isExternal() {
- return this.external;
+ return false;
}
- public void setExternal(boolean flag) {
- this.external = flag;
+ public void setInternalRedirect(boolean flag) {
+ this.internalRedirect = flag;
if ( flag ) {
((RequestWrapper)this.request).setRequestURI(this.prefix,
this.uri);
}
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.environment.Environment#isInternRedirect()
+ */
+ public boolean isInternalRedirect() {
+ return this.internalRedirect;
}
}
1.11 +8 -1
cocoon-2.2/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java
Index: MutableEnvironmentFacade.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MutableEnvironmentFacade.java 8 Mar 2004 14:02:46 -0000 1.10
+++ MutableEnvironmentFacade.java 18 Mar 2004 15:15:10 -0000 1.11
@@ -224,4 +224,11 @@
public void reset() {
this.env.reset();
}
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.environment.Environment#isInternRedirect()
+ */
+ public boolean isInternalRedirect() {
+ return env.isInternalRedirect();
+ }
}
1.3 +2 -2
cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/impl/PipelineNode.java
Index: PipelineNode.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/impl/PipelineNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelineNode.java 8 Mar 2004 13:57:38 -0000 1.2
+++ PipelineNode.java 18 Mar 2004 15:15:10 -0000 1.3
@@ -169,7 +169,7 @@
} catch (Exception ex) {
- if (!externalRequest) {
+ if (!externalRequest && !env.isInternalRedirect()) {
// Propagate exception on internal requests
throw ex;
1.26 +1 -1
cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/TreeProcessor.java
Index: TreeProcessor.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/TreeProcessor.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TreeProcessor.java 17 Mar 2004 20:53:58 -0000 1.25
+++ TreeProcessor.java 18 Mar 2004 15:15:10 -0000 1.26
@@ -391,7 +391,7 @@
}
Environment newEnv = new ForwardEnvironmentWrapper(environment,
m_manager, uri, getLogger());
- //((ForwardEnvironmentWrapper)newEnv).setExternal(true);
+ ((ForwardEnvironmentWrapper)newEnv).setInternalRedirect(true);
if (facade != null) {
// Change the facade delegate