You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2003/07/06 13:44:31 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper RequestWrapper.java
sylvain 2003/07/06 04:44:31
Modified: src/java/org/apache/cocoon Cocoon.java Processor.java
ProcessorWrapper.java
src/java/org/apache/cocoon/components/source/impl
SitemapSource.java
src/java/org/apache/cocoon/components/treeprocessor
InvokeContext.java TreeProcessor.java
src/java/org/apache/cocoon/components/treeprocessor/sitemap
MountNode.java PipelineNode.java PipelinesNode.java
ReadNode.java SerializeNode.java
src/java/org/apache/cocoon/environment
ForwardRedirector.java Request.java
src/java/org/apache/cocoon/environment/commandline
CommandLineRequest.java
src/java/org/apache/cocoon/environment/http HttpRequest.java
src/java/org/apache/cocoon/environment/wrapper
RequestWrapper.java
Log:
Allow flow views to be internal-only pipelines
Revision Changes Path
1.10 +4 -4 cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Cocoon.java 24 Jun 2003 16:44:35 -0000 1.9
+++ Cocoon.java 6 Jul 2003 11:44:30 -0000 1.10
@@ -655,7 +655,7 @@
* a <code>ProcessingPipeline</code>.
* @since 2.1
*/
- public ProcessingPipeline processInternal(Environment environment)
+ public ProcessingPipeline buildPipeline(Environment environment)
throws Exception {
if (disposed) {
throw new IllegalStateException("You cannot process a Disposed Cocoon engine.");
@@ -668,11 +668,11 @@
}
if (this.threadSafeProcessor != null) {
- return this.threadSafeProcessor.processInternal(environment);
+ return this.threadSafeProcessor.buildPipeline(environment);
} else {
Processor processor = (Processor)this.componentManager.lookup(Processor.ROLE);
try {
- return processor.processInternal(environment);
+ return processor.buildPipeline(environment);
}
finally {
this.componentManager.release(processor);
1.3 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/Processor.java
Index: Processor.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Processor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Processor.java 20 Mar 2003 11:45:58 -0000 1.2
+++ Processor.java 6 Jul 2003 11:44:30 -0000 1.3
@@ -85,7 +85,7 @@
* a <code>ProcessingPipeline</code>.
* @since 2.1
*/
- ProcessingPipeline processInternal(Environment environment)
+ ProcessingPipeline buildPipeline(Environment environment)
throws Exception;
/**
1.3 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/ProcessorWrapper.java
Index: ProcessorWrapper.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/ProcessorWrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorWrapper.java 20 Mar 2003 11:45:58 -0000 1.2
+++ ProcessorWrapper.java 6 Jul 2003 11:44:30 -0000 1.3
@@ -90,9 +90,9 @@
* a <code>ProcessingPipeline</code>.
* @since 2.1
*/
- public ProcessingPipeline processInternal(Environment environment)
+ public ProcessingPipeline buildPipeline(Environment environment)
throws Exception {
- return this.processor.processInternal(environment);
+ return this.processor.buildPipeline(environment);
}
/**
1.8 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
Index: SitemapSource.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SitemapSource.java 24 Jun 2003 12:55:13 -0000 1.7
+++ SitemapSource.java 6 Jul 2003 11:44:30 -0000 1.8
@@ -347,7 +347,7 @@
try {
this.processKey = CocoonComponentManager.startProcessing(this.environment);
this.environment.setURI(this.prefix, this.uri);
- this.processingPipeline = this.processor.processInternal(this.environment);
+ this.processingPipeline = this.processor.buildPipeline(this.environment);
this.pipelineProcessor = CocoonComponentManager.getLastProcessor(this.environment);
this.environment.changeToLastContext();
1.2 +10 -10 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
Index: InvokeContext.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvokeContext.java 9 Mar 2003 00:09:16 -0000 1.1
+++ InvokeContext.java 6 Jul 2003 11:44:30 -0000 1.2
@@ -89,7 +89,7 @@
private HashMap nameToMap = new HashMap();
private HashMap mapToName = new HashMap();
- private boolean isInternalRequest;
+ private boolean isBuildingPipelineOnly;
/** The current component manager, as set by the last call to compose() or recompose() */
private ComponentManager currentManager;
@@ -120,7 +120,7 @@
* the current request is external.
*/
public InvokeContext() {
- this.isInternalRequest = false;
+ this.isBuildingPipelineOnly = false;
}
/**
@@ -135,8 +135,8 @@
/**
* Create an <code>InvokeContext</code>
*/
- public InvokeContext(boolean internalRequest) {
- this.isInternalRequest = internalRequest;
+ public InvokeContext(boolean isBuildingPipelineOnly) {
+ this.isBuildingPipelineOnly = isBuildingPipelineOnly;
}
/**
@@ -194,7 +194,7 @@
VariableResolver.buildParameters(this.processingPipelineParameters,
this, this.processingPipelineObjectModel)
);
- if (this.isInternalRequest) {
+ if (this.isBuildingPipelineOnly) {
CocoonComponentManager.addComponentForAutomaticRelease(this.pipelineSelector,
this.processingPipeline,
this.pipelinesManager);
@@ -211,10 +211,10 @@
}
/**
- * Is this an internal request ?
+ * Are we building a pipeline (and not executing it) ?
*/
- public final boolean isInternalRequest() {
- return this.isInternalRequest;
+ public final boolean isBuildingPipelineOnly() {
+ return this.isBuildingPipelineOnly;
}
/**
@@ -304,7 +304,7 @@
*/
public void dispose() {
// Release pipelines, if any
- if (!this.isInternalRequest && this.pipelinesManager != null) {
+ if (!this.isBuildingPipelineOnly && this.pipelinesManager != null) {
if ( this.pipelineSelector != null) {
this.pipelineSelector.release(this.processingPipeline);
1.6 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Index: TreeProcessor.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TreeProcessor.java 11 Jun 2003 13:33:25 -0000 1.5
+++ TreeProcessor.java 6 Jul 2003 11:44:30 -0000 1.6
@@ -333,7 +333,7 @@
* a <code>ProcessingPipeline</code>.
* @since 2.1
*/
- public ProcessingPipeline processInternal(Environment environment)
+ public ProcessingPipeline buildPipeline(Environment environment)
throws Exception {
InvokeContext context = new InvokeContext( true );
1.4 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
Index: MountNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MountNode.java 4 May 2003 20:24:47 -0000 1.3
+++ MountNode.java 6 Jul 2003 11:44:30 -0000 1.4
@@ -119,9 +119,9 @@
try {
env.changeContext(resolvedPrefix, resolvedSource);
- if (context.isInternalRequest()) {
+ if (context.isBuildingPipelineOnly()) {
// Propagate pipelines
- ProcessingPipeline pp = processor.processInternal(env);
+ ProcessingPipeline pp = processor.buildPipeline(env);
if ( pp != null ) {
context.setProcessingPipeline( pp );
return true;
1.5 +9 -4 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
Index: PipelineNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PipelineNode.java 11 Apr 2003 13:14:51 -0000 1.4
+++ PipelineNode.java 6 Jul 2003 11:44:30 -0000 1.5
@@ -63,6 +63,7 @@
import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
import org.apache.cocoon.components.treeprocessor.ProcessingNode;
import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.ObjectModelHelper;
/**
* Handles <map:pipeline>
@@ -150,13 +151,17 @@
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
+
+ Map objectModel = env.getObjectModel();
+
+ boolean internalRequest = ObjectModelHelper.getRequest(objectModel).isInternal();
// Always fail on external resquests if internal only.
- if (this.internalOnly && !context.isInternalRequest()) {
+ if (this.internalOnly && !internalRequest) {
return false;
}
- context.inform(this.processingPipeline, this.parameters, env.getObjectModel());
+ context.inform(this.processingPipeline, this.parameters, objectModel);
try {
if (invokeNodes(children, env, context)) {
@@ -173,7 +178,7 @@
} catch(Exception ex) {
- if (context.isInternalRequest()) {
+ if (internalRequest) {
// Propagate exception on internal requests
throw ex;
1.3 +2 -3 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java
Index: PipelinesNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelinesNode.java 11 Apr 2003 13:14:51 -0000 1.2
+++ PipelinesNode.java 6 Jul 2003 11:44:30 -0000 1.3
@@ -142,9 +142,8 @@
context.recompose(this.manager);
// Build a redirector
- boolean internal = context.isInternalRequest();
ForwardRedirector redirector = new ForwardRedirector(
- env, this.processor, this.manager, internal);
+ env, this.processor, this.manager, context.isBuildingPipelineOnly());
this.setupLogger(redirector);
Map objectModel = env.getObjectModel();
1.2 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java
Index: ReadNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReadNode.java 9 Mar 2003 00:09:22 -0000 1.1
+++ ReadNode.java 6 Jul 2003 11:44:30 -0000 1.2
@@ -114,7 +114,7 @@
env.setStatus(this.statusCode);
}
- if (! context.isInternalRequest()) {
+ if (! context.isBuildingPipelineOnly()) {
// Process pipeline
return pipeline.process(env);
1.3 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
Index: SerializeNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SerializeNode.java 18 Mar 2003 15:23:28 -0000 1.2
+++ SerializeNode.java 6 Jul 2003 11:44:30 -0000 1.3
@@ -145,7 +145,7 @@
env.setStatus(this.statusCode);
}
- if (! context.isInternalRequest()) {
+ if (! context.isBuildingPipelineOnly()) {
// Process pipeline
return pipeline.process(env);
1.5 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/environment/ForwardRedirector.java
Index: ForwardRedirector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/ForwardRedirector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ForwardRedirector.java 24 Jun 2003 15:20:28 -0000 1.4
+++ ForwardRedirector.java 6 Jul 2003 11:44:30 -0000 1.5
@@ -222,7 +222,7 @@
if ( !this.internal ) {
processingResult = usedProcessor.process(newEnv);
} else {
- ProcessingPipeline pp = usedProcessor.processInternal(newEnv);
+ ProcessingPipeline pp = usedProcessor.buildPipeline(newEnv);
if (pp != null) pp.release();
processingResult = pp != null;
}
1.2 +8 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/Request.java
Index: Request.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/Request.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Request.java 9 Mar 2003 00:09:28 -0000 1.1
+++ Request.java 6 Jul 2003 11:44:30 -0000 1.2
@@ -833,4 +833,11 @@
*/
boolean isRequestedSessionIdFromURL();
+
+ /**
+ * Is this an internal request (i.e. a "cocoon:" request) ?
+ *
+ * @return true if the request is internal
+ */
+ boolean isInternal();
}
1.2 +5 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java
Index: CommandLineRequest.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CommandLineRequest.java 9 Mar 2003 00:09:29 -0000 1.1
+++ CommandLineRequest.java 6 Jul 2003 11:44:30 -0000 1.2
@@ -371,4 +371,8 @@
public void setCharacterEncoding(java.lang.String env)
throws java.io.UnsupportedEncodingException { characterEncoding = env; }
public StringBuffer getRequestURL() { return null; }
+
+ public boolean isInternal() {
+ return false;
+ }
}
1.3 +5 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/http/HttpRequest.java
Index: HttpRequest.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/http/HttpRequest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpRequest.java 4 Apr 2003 13:19:07 -0000 1.2
+++ HttpRequest.java 6 Jul 2003 11:44:31 -0000 1.3
@@ -422,4 +422,8 @@
public String getRealPath(String path) {
return this.req.getRealPath(path);
}
+
+ public boolean isInternal() {
+ return false;
+ }
}
1.3 +5 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java
Index: RequestWrapper.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper/RequestWrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RequestWrapper.java 16 Mar 2003 17:49:14 -0000 1.2
+++ RequestWrapper.java 6 Jul 2003 11:44:31 -0000 1.3
@@ -343,5 +343,9 @@
public String getAuthType() {
return this.req.getAuthType();
}
+
+ public boolean isInternal() {
+ return true;
+ }
}