cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Taffelt" <frank.taff...@interface-business.de>
Subject Re: Permanently redirect from flow
Date Thu, 18 Dec 2003 17:46:55 GMT
> I have no problem with this. Can you suggest how you would do it? Have
> you looked into the code to see how it could be implemented?

the connection between flow and cocoon is
\src\java\org\apache\cocoon\components\flow\javascript\fom\FOM_Cocoon.java:

/************* original snippet ********************/
public void jsFunction_redirectTo(String uri) throws Exception {
 // Cannot use environment directly as TreeProcessor uses own version of
redirector
 // environment.redirect(false, uri);
 PipelinesNode.getRedirector(environment).redirect(false, uri);
}


adding a new function add permanent to the flow layer

/************* new code ***********************
public void jsFunction_redirectTo(boolean permant, String uri)
  throws Exception {
  if (permant)
    PipelinesNode.getRedirector(environment).globalRedirect(false, uri);
  else
    // the old way
   jsFunction_redirectTo(uri);
 }

this enhancement should not break any existing code.

the usage from flow would be:

// the old style redirect as ever -> HTTP 302
cocoon.redirectTo('abc');

// using the new redirect routine -> HTTP 301
cocoon.redirectTo(true,'abc');


Frank


Mime
View raw message