bruno 2003/08/06 08:54:13
Modified: src/blocks/apples/java/org/apache/cocoon/components/flow/apples
ApplesProcessor.java
src/java/org/apache/cocoon/components/flow/javascript/fom
FOM_Cocoon.java
src/java/org/apache/cocoon/components/flow
AbstractInterpreter.java
src/documentation/xdocs/userdocs/flow api.xml
src/blocks/apples/samples sitemap.xmap
. status.xml
Log:
Cleaned up the situation with regards to the "uri" argument to
the sendPage, sendPageAndWait, and processPipelineTo functions.
URI's starting with a slash are resolved against the root sitemap,
URI's not starting with a slash are resolved against the current sitemap.
Revision Changes Path
1.3 +0 -6
cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
Index: ApplesProcessor.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ApplesProcessor.java 4 Aug 2003 09:15:50 -0000 1.2
+++ ApplesProcessor.java 6 Aug 2003 15:54:13 -0000 1.3
@@ -58,7 +58,6 @@
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.SourceUtil;
/**
* ApplesProcessor is the core Cocoon component that provides the 'Apples'
@@ -148,12 +147,7 @@
env.redirect(false, res.getURI());
} else {
String uri = res.getURI();
- if (SourceUtil.indexOfSchemeColon(uri) == -1) {
- uri = "cocoon:/" + uri;
- }
-
getLogger().debug("Apple forwards to " + uri + " with bizdata= "
+ res.getData());
-
this.forwardTo(uri, res.getData(), wk, env);
}
1.9 +3 -6
cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java
Index: FOM_Cocoon.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FOM_Cocoon.java 4 Aug 2003 21:07:47 -0000 1.8
+++ FOM_Cocoon.java 6 Aug 2003 15:54:13 -0000 1.9
@@ -158,10 +158,7 @@
String redUri = uri;
- if(! uri.startsWith( "cocoon://" ) ) {
- redUri = "cocoon://" + this.environment.getURIPrefix() + uri;
- }
- FOM_WebContinuation fom_wk =
+ FOM_WebContinuation fom_wk =
new FOM_WebContinuation(wk);
fom_wk.setParentScope(getParentScope());
fom_wk.setPrototype(getClassPrototype(getParentScope(),
@@ -916,7 +913,7 @@
throws Exception {
interpreter.forwardTo(getTopLevelScope(this),
this,
- "cocoon://" + environment.getURIPrefix() + uri,
+ uri,
bean,
fom_wk,
environment);
1.7 +17 -2
cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
Index: AbstractInterpreter.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractInterpreter.java 31 Jul 2003 17:30:13 -0000 1.6
+++ AbstractInterpreter.java 6 Aug 2003 15:54:13 -0000 1.7
@@ -63,6 +63,7 @@
import org.apache.cocoon.environment.Context;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
+import org.apache.excalibur.source.SourceUtil;
import java.io.OutputStream;
import java.util.ArrayList;
@@ -177,9 +178,18 @@
throw new NullPointerException("No outputstream specified for
process");
}
+ // if the uri starts with a slash, then assume that the uri contains
an absolute
+ // path, starting from the root sitemap. Otherwise, the uri is
relative to the current
+ // sitemap.
+ if (uri.length() > 0 && uri.charAt(0) == '/') {
+ uri = uri.substring(1);
+ } else {
+ uri = env.getURIPrefix() + uri;
+ }
+
// Create a wrapper environment for the subrequest to be processed.
EnvironmentWrapper wrapper = new EnvironmentWrapper(env, uri, "",
getLogger());
- wrapper.setURI("",uri);
+ wrapper.setURI("", uri);
wrapper.setOutputStream(out);
wrapper.setAttribute("bean-dict", biz);
@@ -217,6 +227,11 @@
Environment environment)
throws Exception
{
+ if (SourceUtil.indexOfSchemeColon(uri) != -1)
+ throw new Exception("uri is not allowed to contain a scheme
(cocoon:/ is always automatically used)");
+
+ uri = "cocoon:/" + uri;
+
Map objectModel = environment.getObjectModel();
FlowHelper.setContextObject(objectModel, bizData);
FlowHelper.setWebContinuation(objectModel, continuation);
1.24 +4 -3 cocoon-2.1/src/documentation/xdocs/userdocs/flow/api.xml
Index: api.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/api.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- api.xml 28 Jul 2003 17:04:10 -0000 1.23
+++ api.xml 6 Aug 2003 15:54:13 -0000 1.24
@@ -87,7 +87,7 @@
Passes control to the Cocoon sitemap to generate the output page.
</p>
<p>
- <code>uri</code> is the relative URL of the page to be sent back to
the client.
+ <code>uri</code> is the sitemap URI of the page to be sent back to
the client. If the URI starts with a slash, it is resolved starting at the root
sitemap, otherwise it is resolved relative to the current sitemap. The URI
should not contain a scheme (such as cocoon:).
</p>
<p>
<code>bean</code> is a context object which can be accessed inside
this page to extract
@@ -103,7 +103,8 @@
</p>
<p>The flow script is suspended after the page is generated and the
whole execution stack
saved in the WebContinuation object returned from this function. </p>
- <p><code>uri</code> is the relative URL of the page to be sent back to
the client.
+ <p><code>uri</code> is the relative URL of the page to be sent back to
the client. If the URI starts with a slash, it is resolved starting at the root
sitemap, otherwise it is resolved relative to the current sitemap. The URI
should not contain a scheme (such as cocoon:).</p>
+ <p>
<code>bean</code> is a context object which can be accessed inside
this page to extract
various values and place them in the generated page.</p>
<p><code>timeToLive</code> is the time to live in milliseconds for the
continuation created.</p>
@@ -115,7 +116,7 @@
<p>
Call the Cocoon sitemap for the given URI, sending the output of the
eventually matched pipeline to the specified
<code>OutputStream</code>.</p>
- <p><code>uri</code> is the URI for which the request should be
generated.</p>
+ <p><code>uri</code> is the URI for which the request should be
generated. If the URI starts with a slash, it is resolved starting at the root
sitemap, otherwise it is resolved relative to the current sitemap. The URI
should not contain a scheme (such as cocoon:).</p>
<p><code>bizData</code> is the business data object
to be made available to the forwarded pipeline</p>
<p><code>stream</code> is an <code>OutputStream</code> where the output
should be written to.</p>
1.2 +2 -2 cocoon-2.1/src/blocks/apples/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/apples/samples/sitemap.xmap,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sitemap.xmap 4 Aug 2003 08:38:01 -0000 1.1
+++ sitemap.xmap 6 Aug 2003 15:54:13 -0000 1.2
@@ -72,8 +72,8 @@
<map:parameter name="binding-src"
value="context://samples/woody/forms/form2_bind_xml.xml"/>
<map:parameter name="formhandler"
value="org.apache.cocoon.woody.samples.Form1Handler"/>
<map:parameter name="documentURI"
value="context://samples/woody/forms/form2_data.xml"/>
- <map:parameter name="form-pipe"
value="cocoon://samples/woody/form2-display-pipeline"/>
- <map:parameter name="valid-pipe"
value="cocoon://samples/woody/form2-success-pipeline"/>
+ <map:parameter name="form-pipe"
value="/samples/woody/form2-display-pipeline"/>
+ <map:parameter name="valid-pipe"
value="/samples/woody/form2-success-pipeline"/>
</map:call>
</map:match>
1.105 +8 -1 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- status.xml 6 Aug 2003 14:45:02 -0000 1.104
+++ status.xml 6 Aug 2003 15:54:13 -0000 1.105
@@ -167,6 +167,13 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="BRD" type="fix">
+ IMPORTANT: Flow: cleaned up the situation with regards to the "uri"
argument to the
+ sendPage, sendPageAndWait, and processPipelineTo functions. URI's
starting
+ with a slash are resolved against the root sitemap, URI's not starting
with
+ a slash are resolved against the current sitemap. Specifying a scheme is
not
+ allowed.
+ </action>
<action dev="BRD" type="fix" fixes-bug="19841">
I18nTransformer: if content of i18n:text is empty and translation is not
found, use untranslated-text.