sylvain 2003/07/06 13:37:48
Modified: . status.xml src/blocks/linotype/samples sitemap.xmap src/java/org/apache/cocoon/components/treeprocessor/sitemap PipelineNode.java src/java/org/apache/cocoon/environment Environment.java Request.java src/java/org/apache/cocoon/environment/commandline AbstractCommandLineEnvironment.java CommandLineRequest.java src/java/org/apache/cocoon/environment/http HttpEnvironment.java HttpRequest.java src/java/org/apache/cocoon/environment/wrapper EnvironmentWrapper.java RequestWrapper.java src/test/org/apache/cocoon/environment/mock MockEnvironment.java MockRequest.java Log: Changed my mind : Request.isInternal can lead to confusion. So added Environment.isExternal() Revision Changes Path 1.81 +2 -3 cocoon-2.1/status.xml Index: status.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/status.xml,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- status.xml 6 Jul 2003 11:46:55 -0000 1.80 +++ status.xml 6 Jul 2003 20:37:47 -0000 1.81 @@ -184,8 +184,7 @@ <release version="@version@" date="@date@"> <action dev="SW" type="fix"> - Flow view can now be in "internal-only" pipelines. This required adding a new isInternal() - method on the Request interface. + Flow view can now be in "internal-only" pipelines. </action> <action dev="JH" type="update"> Updated FOP to 0.20.5rc3a. 1.2 +1 -1 cocoon-2.1/src/blocks/linotype/samples/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/linotype/samples/sitemap.xmap,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sitemap.xmap 17 Jun 2003 01:32:44 -0000 1.1 +++ sitemap.xmap 6 Jul 2003 20:37:47 -0000 1.2 @@ -173,7 +173,7 @@ <!-- ========================= Private Resources =========================== --> - <map:pipeline> + <map:pipeline internal-only="true"> <map:match pattern="news"> <map:generate src="cocoon:/news.xml"/> 1.6 +5 -7 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- PipelineNode.java 6 Jul 2003 11:44:30 -0000 1.5 +++ PipelineNode.java 6 Jul 2003 20:37:47 -0000 1.6 @@ -152,16 +152,14 @@ public final boolean invoke(Environment env, InvokeContext context) throws Exception { - Map objectModel = env.getObjectModel(); - - boolean internalRequest = ObjectModelHelper.getRequest(objectModel).isInternal(); + boolean externalRequest = env.isExternal(); // Always fail on external resquests if internal only. - if (this.internalOnly && !internalRequest) { + if (this.internalOnly && externalRequest) { return false; } - context.inform(this.processingPipeline, this.parameters, objectModel); + context.inform(this.processingPipeline, this.parameters, env.getObjectModel()); try { if (invokeNodes(children, env, context)) { @@ -178,7 +176,7 @@ } catch(Exception ex) { - if (internalRequest) { + if (!externalRequest) { // Propagate exception on internal requests throw ex; 1.4 +10 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/Environment.java Index: Environment.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/Environment.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Environment.java 4 May 2003 19:03:01 -0000 1.3 +++ Environment.java 6 Jul 2003 20:37:48 -0000 1.4 @@ -232,5 +232,14 @@ * This can be used to cleanup the environment object */ 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. + * + * @return true is this environment is external + */ + boolean isExternal(); } 1.3 +1 -8 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Request.java 6 Jul 2003 11:44:30 -0000 1.2 +++ Request.java 6 Jul 2003 20:37:48 -0000 1.3 @@ -833,11 +833,4 @@ */ boolean isRequestedSessionIdFromURL(); - - /** - * Is this an internal request (i.e. a "cocoon:" request) ? - * - * @return true if the request is internal - */ - boolean isInternal(); } 1.4 +9 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/commandline/AbstractCommandLineEnvironment.java Index: AbstractCommandLineEnvironment.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/commandline/AbstractCommandLineEnvironment.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AbstractCommandLineEnvironment.java 4 Jun 2003 09:25:53 -0000 1.3 +++ AbstractCommandLineEnvironment.java 6 Jul 2003 20:37:48 -0000 1.4 @@ -201,4 +201,12 @@ public String getContentType() { return this.contentType; } + + /** + * Always return <code>true</code>. + */ + public boolean isExternal() { + return true; + } + } 1.3 +2 -5 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommandLineRequest.java 6 Jul 2003 11:44:30 -0000 1.2 +++ CommandLineRequest.java 6 Jul 2003 20:37:48 -0000 1.3 @@ -371,8 +371,5 @@ public void setCharacterEncoding(java.lang.String env) throws java.io.UnsupportedEncodingException { characterEncoding = env; } public StringBuffer getRequestURL() { return null; } - - public boolean isInternal() { - return false; - } + } 1.11 +8 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java Index: HttpEnvironment.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- HttpEnvironment.java 24 Jun 2003 15:20:28 -0000 1.10 +++ HttpEnvironment.java 6 Jul 2003 20:37:48 -0000 1.11 @@ -316,5 +316,12 @@ } return super.getOutputStream( bufferSize ); } + + /** + * Always return <code>true</code>. + */ + public boolean isExternal() { + return true; + } } 1.4 +1 -5 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HttpRequest.java 6 Jul 2003 11:44:31 -0000 1.3 +++ HttpRequest.java 6 Jul 2003 20:37:48 -0000 1.4 @@ -422,8 +422,4 @@ public String getRealPath(String path) { return this.req.getRealPath(path); } - - public boolean isInternal() { - return false; - } } 1.7 +8 -1 cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java Index: EnvironmentWrapper.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- EnvironmentWrapper.java 16 May 2003 07:04:55 -0000 1.6 +++ EnvironmentWrapper.java 6 Jul 2003 20:37:48 -0000 1.7 @@ -365,4 +365,11 @@ this.environment.removeAttribute(name); } + /** + * Always return <code>false</code>. + */ + public boolean isExternal() { + return false; + } + } 1.4 +2 -7 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- RequestWrapper.java 6 Jul 2003 11:44:31 -0000 1.3 +++ RequestWrapper.java 6 Jul 2003 20:37:48 -0000 1.4 @@ -342,10 +342,5 @@ public String getAuthType() { return this.req.getAuthType(); - } - - public boolean isInternal() { - return true; - } - + } } 1.3 +8 -0 cocoon-2.1/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java Index: MockEnvironment.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockEnvironment.java 4 May 2003 19:01:59 -0000 1.2 +++ MockEnvironment.java 6 Jul 2003 20:37:48 -0000 1.3 @@ -251,5 +251,13 @@ public void release(org.apache.excalibur.source.Source source) { resolver.release(source); } + + /** + * Always return <code>true</code>. + */ + public boolean isExternal() { + return true; + } + } 1.6 +0 -4 cocoon-2.1/src/test/org/apache/cocoon/environment/mock/MockRequest.java Index: MockRequest.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/test/org/apache/cocoon/environment/mock/MockRequest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MockRequest.java 6 Jul 2003 11:44:47 -0000 1.5 +++ MockRequest.java 6 Jul 2003 20:37:48 -0000 1.6 @@ -367,8 +367,4 @@ parameters.clear(); headers.clear(); } - - public boolean isInternal() { - return true; - } }