You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ni...@apache.org on 2004/09/02 16:07:24 UTC
svn commit: rev 37379 - in cocoon/trunk: . src/java/org/apache/cocoon/components/treeprocessor/sitemap
Author: nicolaken
Date: Thu Sep 2 07:07:22 2004
New Revision: 37379
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
cocoon/trunk/status.xml
Log:
<action dev="NKB" type="add">
New @pass-through attribute for the sitemap mount node.
If true, processing will resume in the base sitemap just after the mount node
if the mounted sitemap has not already generated output (usually if no match
is found). Previous behaviour was always to throw a ResourceNotFoundException.
The attribute defaults to "false" for backwards compatibility.
</action>
_SIDENOTE_ Also fixed a validation error in status.xml
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
==============================================================================
--- 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 Thu Sep 2 07:07:22 2004
@@ -32,7 +32,7 @@
*
* @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
- * @version CVS $Id: MountNode.java,v 1.15 2004/06/24 13:18:01 cziegeler Exp $
+ * @version CVS $Id$
*/
public class MountNode extends AbstractProcessingNode
implements Disposable {
@@ -52,14 +52,22 @@
/** The value of the 'check-reload' attribute */
private final boolean checkReload;
+ /** The value of the 'pass-through' attribute */
+ private final boolean passThrough;
+
+ /** The key to get the pass_through value fron the Environment*/
+ protected final static String COCOON_PASS_THROUGH = new String("COCOON_PASS_THROUGH");
+
public MountNode(VariableResolver prefix,
VariableResolver source,
TreeProcessor parentProcessor,
- boolean checkReload) {
+ boolean checkReload,
+ boolean passThrough) {
this.prefix = prefix;
this.source = source;
this.parentProcessor = parentProcessor;
this.checkReload = checkReload;
+ this.passThrough = passThrough;
}
/* (non-Javadoc)
@@ -68,6 +76,9 @@
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
+ Object previousPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
+ env.setAttribute(COCOON_PASS_THROUGH,Boolean.valueOf(passThrough));
+
final Map objectModel = env.getObjectModel();
String resolvedSource = this.source.resolve(context, objectModel);
@@ -102,7 +113,11 @@
} finally {
// Restore context
env.setURI(oldPrefix, oldURI);
-
+ if(previousPassThrough != null){
+ env.setAttribute(COCOON_PASS_THROUGH,previousPassThrough);
+ }else{
+ env.removeAttribute(COCOON_PASS_THROUGH);
+ }
// Turning recomposing as a test, according to:
// http://marc.theaimsgroup.com/?t=106802211400005&r=1&w=2
// Recompose pipelines which may have been recomposed by subsitemap
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java Thu Sep 2 07:07:22 2004
@@ -24,7 +24,7 @@
/**
*
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
- * @version CVS $Id: MountNodeBuilder.java,v 1.4 2004/06/05 08:18:50 sylvain Exp $
+ * @version CVS $Id$
*/
public class MountNodeBuilder extends AbstractProcessingNodeBuilder implements ThreadSafe {
@@ -40,8 +40,10 @@
VariableResolverFactory.getResolver(config.getAttribute("uri-prefix"), manager),
VariableResolverFactory.getResolver(config.getAttribute("src"), manager),
this.treeBuilder.getProcessor().getWrappingProcessor(),
- config.getAttributeAsBoolean("check-reload", true)
+ config.getAttributeAsBoolean("check-reload", true),
+ config.getAttributeAsBoolean("pass-through", false)
);
+
return (this.treeBuilder.setupNode(node, config));
}
}
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java Thu Sep 2 07:07:22 2004
@@ -26,6 +26,7 @@
import org.apache.cocoon.components.treeprocessor.InvokeContext;
import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
import org.apache.cocoon.components.treeprocessor.ProcessingNode;
+import org.apache.cocoon.components.treeprocessor.sitemap.MountNode;
import org.apache.cocoon.environment.Environment;
/**
@@ -36,7 +37,7 @@
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
* @author <a href="mailto:gianugo@apache.org">Gianugo Rabellino</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: PipelineNode.java,v 1.17 2004/07/15 12:49:50 sylvain Exp $
+ * @version CVS $Id$
*/
public class PipelineNode
extends AbstractParentProcessingNode
@@ -114,6 +115,17 @@
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
+ boolean passThrough;
+
+ Object passThroughRaw = env.getAttribute(MountNode.COCOON_PASS_THROUGH);
+
+ if(passThroughRaw == null){
+ //use legacy default value
+ passThrough = false;
+ }else{
+ passThrough = ((Boolean)passThroughRaw).booleanValue() ;
+ }
+
boolean externalRequest = env.isExternal();
// Always fail on external request if pipeline is internal only.
@@ -125,7 +137,7 @@
try {
if (invokeNodes(children, env, context)) {
return true;
- } else if (!this.isLast) {
+ } else if (!this.isLast || passThrough) {
return false;
} else {
throw new ResourceNotFoundException("No pipeline matched request: " +
Modified: cocoon/trunk/status.xml
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Thu Sep 2 07:07:22 2004
@@ -204,6 +204,13 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="NKB" type="add">
+ New @pass-through attribute for the sitemap mount node.
+ If true, processing will resume in the base sitemap just after the mount node
+ if the mounted sitemap has not already generated output (usually if no match
+ is found). Previous behaviour was always to throw a ResourceNotFoundException.
+ The attribute defaults to "false" for backwards compatibility.
+ </action>
<action dev="CZ" type="add">
New getSitemapPath() method on the Request object to get the path to the
current sitemap even if you are in a sub sitemap. Added an abstract request
@@ -326,7 +333,7 @@
<action dev="VG" type="update">
Reworked LocaleAction and LocaleMatcher to have similar logic and
configuration.
- <br/><strong>NOTE:</strong> Sitemap variable "lang" renamed to
+ <br/>NOTE: Sitemap variable "lang" renamed to
"language", removed configuration parameters: "language-attribute",
"country-attribute", "variant-attribute".
</action>