Author: vgritsenko
Date: Tue Oct 19 08:26:10 2004
New Revision: 55068
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallFunctionNode.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallNodeBuilder.java
cocoon/branches/BRANCH_2_1_X/src/test/anteater/redirect.xml
cocoon/branches/BRANCH_2_1_X/status.xml
Log:
Forbid flowscripts with no response
http://marc.theaimsgroup.com/?t=106849566300008&r=1
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallFunctionNode.java
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallFunctionNode.java
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallFunctionNode.java
Tue Oct 19 08:26:10 2004
@@ -1,12 +1,12 @@
/*
* 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.
@@ -33,6 +33,7 @@
import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
import
org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.sitemap.PatternException;
/**
@@ -112,25 +113,33 @@
params = resolveList(parameters, manager, context,
env.getObjectModel());
}
- String continuation = continuationId.resolve(context,
env.getObjectModel());
+ // Need redirector in any case
+ Redirector redirector = context.getRedirector();
// If the continuation id is not null, it takes precedence over
// the function call, so we invoke it here.
+ String continuation = continuationId.resolve(context,
env.getObjectModel());
if (continuation != null && continuation.length() > 0) {
- interpreter.handleContinuation(continuation, params,
context.getRedirector());
+ interpreter.handleContinuation(continuation, params, redirector);
+ if (!redirector.hasRedirected()) {
+ throw new ProcessingException("<map:call continuation> did not
send a response, at " +
+ getLocation());
+ }
return true;
}
// We don't have a continuation id passed in <map:call>, so invoke
// the specified function
-
String name = functionName.resolve(context, env.getObjectModel());
-
if (name != null && name.length() > 0) {
- interpreter.callFunction(name, params, context.getRedirector());
+ interpreter.callFunction(name, params, redirector);
+ if (!redirector.hasRedirected()) {
+ throw new ProcessingException("<map:call function> did not
send a response, at " +
+ getLocation());
+ }
return true;
}
-
+
// Found neither continuation nor function to call
throw new ProcessingException("No function nor continuation given in
<map:call function> at " + getLocation());
}
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallNodeBuilder.java
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallNodeBuilder.java
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallNodeBuilder.java
Tue Oct 19 08:26:10 2004
@@ -1,12 +1,12 @@
/*
* 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.
@@ -30,11 +30,10 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a>
- * @version CVS $Id: CallNodeBuilder.java,v 1.3 2004/03/05 13:02:51
bdelacretaz Exp $
+ * @version CVS $Id$
*/
-
public class CallNodeBuilder extends AbstractProcessingNodeBuilder
- implements LinkedProcessingNodeBuilder {
+ implements LinkedProcessingNodeBuilder {
protected ProcessingNode node;
protected String resourceName;
@@ -42,8 +41,7 @@
protected String continuationId;
public ProcessingNode buildNode(Configuration config)
- throws Exception
- {
+ throws Exception {
resourceName = config.getAttribute("resource", null);
functionName = config.getAttribute("function", null);
continuationId = config.getAttribute("continuation", null);
@@ -60,7 +58,7 @@
VariableResolverFactory.getResolver(functionName,
this.manager),
VariableResolverFactory.getResolver(continuationId,
this.manager)
);
-
+
} else {
// Building a Call(Resource)Node
if (functionName != null || continuationId != null) {
@@ -73,7 +71,7 @@
}
this.treeBuilder.setupNode(this.node, config);
- if (node instanceof Configurable)
+ if (node instanceof Configurable)
((Configurable)this.node).configure(config);
return this.node;
Modified: cocoon/branches/BRANCH_2_1_X/src/test/anteater/redirect.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/test/anteater/redirect.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/test/anteater/redirect.xml Tue Oct 19
08:26:10 2004
@@ -62,7 +62,7 @@
<httpRequest href="${redirect-test}/donothing-from-flow">
<match>
- <responseCode value="404"/>
+ <responseCode value="500"/>
</match>
</httpRequest>
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Oct 19 08:26:10 2004
@@ -205,6 +205,10 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="VG" type="update">
+ Flow invocations (function calls or continuation invocations) should
always
+ result in a response. Flowscripts with no response are prohibited.
+ </action>
<action dev="CZ" type="add" due-to="Juergen Seitz" due-to-email="[EMAIL
PROTECTED]">
Portal block: Apply batch for configuring the type handling in the Castor
converter.
</action>
@@ -223,9 +227,9 @@
<action dev="TC" type="fix" fixes-bug="31545">
Throw a more meaningful exception if charset classes are missing
</action>
- <action dev="TC" type="fix" fixes-bug="30874">
+ <action dev="TC" type="fix" fixes-bug="30874">
Fixes the SQLTransformer not to close the statement twice
- </action>
+ </action>
<action dev="TC" type="fix" fixes-bug="30994">
Change constructor to be public in order to fix bug 30270
</action>