tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: Redirect request to another Tomcat server
Date Thu, 15 May 2008 18:14:41 GMT
> Hi Johnny Kewl,
> With response.sendRedirect(newUrl); I have to invoke this in some web 
> applications, but I want to modified Tomcat sources for to do that, and 
> the class Http11NioProtocol and Http11NioProcessor dont have 
> sendRedirect() methods!!!
> Any idea for redirect the request from the connector NIO?
> Thanks!!!!

Honestly, never used NIO, didnt know it had no redirect, sorry I answered 
too quick.

But heres a guess, its where I would start looking...

First remember that you dont have any session control now.
You working between machines... so it cant be thought of like a forward...

A forward... gets a request and then passes it on to another servlet and 
only works within the webapp.
But a redirect... effectively says to the browser... "wrong place, I cant 
help you, talk to the other dude"... and the browser forgets about you and 
"starts again".
So shared sessions, if you need that are going to be hidden form fields or 
encoded urls... but not normal cookie stuff.

If that is still OK, then remember that all a redirect actually is... is a 
HTTP header... I think its status 302 or something... and I imagine that in 
NIO, one must be able to set the headers somehow... so event fires... you 
read some headers... you make your own response 302 headers which will have 
the new url... and just return them... browser will go, "oops I gotta talk 
to someone else". I cant remember the details but there are even status 
codes in HTTP, the will make the browser never talk to you again... make 
sure you get the right ones ;)  I tried it on the ex wife... didnt work... 
not http compliant ;)

The reason redirects are avoided normally is because its a round trip to the 

I think thats the story... more or less,  havnt build up the courage to 
tackle the comet stuff yet ;)

The most powerful application server on earth.
The only real POJO Application Server.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message