You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Winkler, Steve" <st...@sapmarkets.com> on 2001/03/14 07:27:24 UTC

internal forwarding


Next question:  I've been trying to figure out how to forward some
information contained in a java object on a conditional basis to another
page that could process that object.  JSP would suggest using the
set/getAttribute functions of the HttpServletRequest, and then doing a
getDispatcher("workerpage").forward(request,response).  

Basically I want to do this:

When requesting http://myserver/somexsppage.xml?action=forward


<xsp:logic>
String action = request.getParameter("action");
if( action.equals( "forward" )) {
	SomeObject o = new SomeObject( a, bunch, of, params );
	request.setAttribute( "anobject", o );
	request.getDispatcher("workerpage").forward(request,response);
}

</xsp:logic>

Unfortunately this doesn't seem to work in Cocoon because they do some funky
stuff with wrapping the request.  I'm not sure how all this works, but in
trying to find out I found the following post on the dev group.  I was
curious if anyone out there could tell me if there's been any resolution to
this issue and if it is incorporated in 1.82.


Thanks for your help,

Steve


Vadim Gritsenko wrote:
> 
> How about <map:forward-to internal="..."/>?
> 
> The difference between HTTP redirect and internal forwarding is that in
case
> of
> redirecting client gets HTTP redirect code (300+), and in case of
forwarding
> existing HttpServletRequest object is used as input to forwarded page -
so,
> pages can store some state information in request object.

Your suggestions might be right but I'd like to keep down with the
introduction of new elements into the sitemaps schema. So for me a

   <map:redirect-to internal="...."/> 

would be fine.

I wish I had implemented all those resource references strictly as URL.
But since Stefano mentioned that Avalon might build up a general URL
Handler framework we agreed to be fine with it for now :(

Giacomo

> 
> AFAIK, forwarding is implemented in servlets API:
>     request.getRequestDispatcher("some/page").forward(request, response);
> This code should invoke CocoonServlet (if "some/page" registered with it)
> once again.
> Does anybody have an idea does this piece of code work with Cocoon or not?
> 
> Thanks,
> Vadim
> 
> > -----Original Message-----
> > From: Paul Russell [mailto:paulr@luminas.co.uk]On Behalf Of Paul Russell
> > Sent: Monday, December 04, 2000 9:48 AM
> > To: cocoon-dev@xml.apache.org
> > Subject: Re: [RT] redirection vs. aliases
> >
> >
> > On Mon, Dec 04, 2000 at 09:28:59AM -0500, Berin Loritsch wrote:
> > > > What you want is something like:
> > > >
> > > >   <map:redirect-to cocoon="..."/>
> > > >
> > > > which should reinvoke the sitemap engine with a different
requestURI,
> > > > right? If this is the case we have to extend the Environment
interface
> > > > to let the sitemap notice the Environment to change the requestURI
and
> > > > reinvoke itself again?
> > > Yes.  This is what I would like.  This would work wonders within the
> > > framework of one Cocoon webapp.
> >
> > Yahuh. Could we make it <map:redirect-to internal="..."/>
> > though? I don't think 'cocoon' is particularly clear as an
> > attribute name.. Thoughts?
> >
> >
> > P.
> >
> > --
> > Paul Russell                               <pa...@luminas.co.uk>
> > Technical Director,                   http://www.luminas.co.uk
> > Luminas Ltd.
> >

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>