cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <>
Subject [flow] forwardTo()
Date Tue, 22 Jul 2003 14:12:34 GMT
Hi all,

Trying to understand some more flow internals...

I just checked the on how it handles the redirects...

and this seems to be the relevant portion:

String redUri = uri;
if(! uri.startsWith( "cocoon://" ) ) {
     redUri = "cocoon://" + this.environment.getURIPrefix() + uri;

where I assume the variable uri is holding what
sendPage()/sendPageAndWait() got as a first argument?

Some careful questions (only valid if my current assumptions are

1/ do we explicitely want to prohibit the usage of ANY valid uri
to redirect to?

I guess that http://whatever-uri should be able to work as well,
no?  Maybe we should just be checking for the presence of a
'scheme' part in the URI?
(and even if we don't want to have client-side-redirect uri's
ripple through then we should at least check and warn accordingly?)

2/ when selecting a sitemap-pipeline do we explicitely want to
have everything resolved versus the top level sitemap?

if we would just append 'cocoon:/' (ONE slash) then the
flow-writer can control if he wants to select relative to the
current sitemap or relative to the root sitemap (by letting his
uri start with a '/' or not)

     --> cocoon:/localmap/uri-part
     --> cocoon://topmap/whatever

3/ is this behaviour a general property of 'flow' or is it 
specific to how the JSInterpreter handles things?

personally I think we can tackle this on the level of the
AbstractInterpreter so this line of thinking becomes available to 
all flow implementations?

if all 3 comments make sense the following could become the new
implementation of AbstractInterpreter.forwardTo() (and we could 
offload the burdon from the current implementations)

import org.apache.excalibur.source.SourceUtil;

public void forwardTo(String uri, Object bizData,
                         WebContinuation continuation,
                         Environment environment)
           throws Exception
       if (SourceUtil.indexOfSchemeColon(uri) == -1) {
           uri = "cocoon:/" + uri;

       Map objectModel = environment.getObjectModel();
       FlowHelper.setContextObject(objectModel, bizData);
       FlowHelper.setWebContinuation(objectModel, continuation);
                    .redirect(false, uri);

what do others think?

Marc Portier                  
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                        

View raw message