Raphaël Luta escribió:
>
> ingo schuster wrote:
> >
> > At 12:16 01/20/01, Mirko Buholzer wrote:
> > >Hi all ...
> > >
> > >Just for Information, you can redirect a request in a Servlet like this:
> > >
> > >public void doGet(HttpServletRequest request, HttpServletResponse
> > >response) {
> > >
> > > response.setContentType("text/html");
> > > response.setStatus(response.SC_MOVED_TEMPORARILY);
> > > response.setHeader("Location", "/jetspeed/portal/screen/Home");
> > >}
> >
> > Ok, what you're saying is that all forms could post the data to
> > /screen/<xy>/action/<z> and if the action was executed successfully, it
> > redirects to /screen/Home (or whatever else you want). In this case the
> > last request results from a redirect operation and not from a post request
> > so that a reload doesn't trigger a repost of data.
> > I'll try this. What about the URL? If I do it like this, will the browser
> > change its URL or will it still display /screen/<xy>/action/<z> after the
> > redirect?
> >
>
> Depends on the HTTP server. If you use the previous code with Apache, I
> think that Apache handled the redirect itself because it's not a legal
> URL. Other HTTP servers don't do it usually and expect the client to handle
> this kind of links.
>
> HTTP spec says the Location header sent to a client should always be
> a full URL.
>
> BTW, the example code breaks the URL session handling that may be
> configured on the servlet container.
>
> The code should be:
>
> response.sendRedirect(response.encodeRedirectURL(<whateverURL>));
>
Just a small thing: we should use the rundata methods for doing that.
There may be code inside turbine (I'm quite sure there IS) handling
redirects, so we should handle it through it.
I think it is
data.declareRedirectResponse();
data.setStatusCode( 3XX ... );
data.setRedirectURI( url );
data.getResponse().sendRedirect( ... );
although it look a little bit too complex and with little abstraction.
Maybe if we look in the turbine list for examples...
> --
> Raphaël Luta - [EMAIL PROTECTED]
> Vivendi Universal Networks - Services Manager / Paris
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/[email protected]/>
> List Help?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/[email protected]/>
List Help?: [EMAIL PROTECTED]