Author: sylvain Date: Mon May 2 08:16:37 2005 New Revision: 165642 URL: http://svn.apache.org/viewcvs?rev=165642&view=rev Log: Fix a weird correlation between pass-through mounts and cocoon: that led to throwing a NPE rather than a RNFE
Added: cocoon/trunk/src/webapp/samples/test/pass-through/ cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap (with props) cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/ cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml (with props) cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap (with props) cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml (with props) cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap (with props) cocoon/trunk/src/webapp/samples/test/pass-through/sub/ cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml (with props) cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap (with props) cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml (with props) Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java?rev=165642&r1=165641&r2=165642&view=diff ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java Mon May 2 08:16:37 2005 @@ -39,7 +39,7 @@ implements Disposable { /** The key to get the pass_through value from the Environment*/ - protected final static String COCOON_PASS_THROUGH = "COCOON_PASS_THROUGH"; + public final static String COCOON_PASS_THROUGH = "COCOON_PASS_THROUGH"; /** The 'uri-prefix' attribute */ Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java?rev=165642&r1=165641&r2=165642&view=diff ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java Mon May 2 08:16:37 2005 @@ -20,6 +20,7 @@ import java.util.Enumeration; import java.util.Map; +import org.apache.cocoon.components.treeprocessor.sitemap.MountNode; import org.apache.cocoon.environment.Environment; /** @@ -43,6 +44,10 @@ public MutableEnvironmentFacade(EnvironmentWrapper env) { this.env = env; + // Ensure we start with a false passthrough flag. + // FIXME: this should really be part of the Processor contract rather + // than an environment attribute + env.setAttribute(MountNode.COCOON_PASS_THROUGH, Boolean.FALSE); } public EnvironmentWrapper getDelegate() { Added: cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap Mon May 2 08:16:37 2005 @@ -0,0 +1,20 @@ +<?xml version="1.0"?> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + <map:pipelines> + <map:pipeline> + <map:match pattern="another-welcome"> + <map:generate src="cocoon:/non-existing-url"/> + <map:serialize/> + </map:match> + <map:handle-errors> + <map:select type="exception"> + <map:when test="not-found"> + <map:generate src="welcome.xml"/> + <map:serialize type="html"/> + </map:when> + </map:select> + </map:handle-errors> + </map:pipeline> + </map:pipelines> +</map:sitemap> \ No newline at end of file Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/another-sitemap.xmap ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml Mon May 2 08:16:37 2005 @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation or its licensors, + as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<h1>Hello!</h1> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/hello.xml ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap Mon May 2 08:16:37 2005 @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation or its licensors, + as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + <map:pipelines> + <map:pipeline> + <!-- this sitemap is mounted with pass-through, but contains + no matcher so that we go back to the parent sitemap --> + </map:pipeline> + </map:pipelines> +</map:sitemap> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap ------------------------------------------------------------------------------ svn:executable = * Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/elsewhere/sitemap.xmap ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml Mon May 2 08:16:37 2005 @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- CVS $Id$ --> + +<page> + <title>Sitemap pass-through test pages</title> + <content> + <para> + Shows that mounted pass-through breaks when a "cocoon:" is used + after going back to the parent sitemap (<link + href="http://issues.apache.org/bugzilla/show_bug.cgi?id=33178">bug + #33178</link>). + </para> + <para> + Test links: + <ul> + <li><link href="welcome">Direct pipeline</link></li> + <li><link href="welcome1">One "cocoon:" URL</link></li> + <li><link href="welcome2">Two chained "cocoon:" URLs</link></li> + <li><link href="welcome3">Three chained "cocoon:" URLs</link></li> + <li><link href="aggregate">Aggregation of the above</link></li> + </ul> + </para> + <para> + A "cocoon:" called within a pass-trough mount leading to no match reported an NPE + rather than a ResourceNotFound. With the bugfix, the RNFE is catched, and the "welcome" + page is displayed. + </para> + <para><link href="another-welcome">Test link</link></para> + </content> +</page> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/explain-test.xml ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap Mon May 2 08:16:37 2005 @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation or its licensors, + as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + <map:pipelines> + <map:pipeline> + <map:mount check-reload="true" uri-prefix="" + src="elsewhere/sitemap.xmap" pass-through="true"/> + + <map:match pattern="sub/**"> + <map:mount src="sub/" uri-prefix="sub"/> + </map:match> + + <map:match pattern="welcome"> + <map:generate src="welcome.xml"/> + <map:serialize/> + </map:match> + + <map:match pattern="welcome1"> + <map:generate src="cocoon:/welcome"/> + <map:serialize/> + </map:match> + + <map:match pattern="welcome2"> + <map:generate src="cocoon:/welcome1"/> + <map:serialize/> + </map:match> + + <map:match pattern="welcome3"> + <map:generate src="cocoon:/welcome2"/> + <map:serialize/> + </map:match> + + <map:match pattern="hellosub"> + <!-- This pattern deliberately produces and error, as it is meant to trap + wrong active processor in the handling of sub/sub1 --> + <map:serialize/> + </map:match> + + <map:match pattern="subsub1"> + <map:generate src="cocoon:/sub/sub1"/> + <map:serialize/> + </map:match> + + <map:match pattern="aggregate"> + <map:aggregate element="root"> + <map:part src="cocoon:/welcome3"/> + <map:part src="cocoon:/welcome3"/> + <map:part src="cocoon:/subsub1"/> + </map:aggregate> + <map:serialize/> + </map:match> + + <!-- a test that produces an NPE in SitemapSource when there's a pass-through mount in the same directory --> + + <map:mount check-reload="true" uri-prefix="" + src="another-sitemap.xmap" pass-through="true"/> + + </map:pipeline> + </map:pipelines> +</map:sitemap> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap ------------------------------------------------------------------------------ svn:executable = * Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sitemap.xmap ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml Mon May 2 08:16:37 2005 @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation or its licensors, + as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<h1>Hello Sub!</h1> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sub/hellosub.xml ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap Mon May 2 08:16:37 2005 @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation or its licensors, + as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + <map:pipelines> + <map:pipeline> + <map:match pattern="hellosub"> + <map:generate src="hellosub.xml"/> + <map:serialize/> + </map:match> + + <map:match pattern="sub1"> + <map:generate src="cocoon:/hellosub"/> + <map:serialize/> + </map:match> + </map:pipeline> + </map:pipelines> +</map:sitemap> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap ------------------------------------------------------------------------------ svn:executable = * Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/sub/sitemap.xmap ------------------------------------------------------------------------------ svn:keywords = Id Added: cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml?rev=165642&view=auto ============================================================================== --- cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml (added) +++ cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml Mon May 2 08:16:37 2005 @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 The Apache Software Foundation or its licensors, + as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<h1>Welcome!</h1> Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: cocoon/trunk/src/webapp/samples/test/pass-through/welcome.xml ------------------------------------------------------------------------------ svn:keywords = Id