jim ma wrote:
On Thu, Nov 20, 2008 at 10:24 PM, André Warnier <[EMAIL PROTECTED]> wrote:

jim ma wrote:

On Thu, Nov 20, 2008 at 6:48 PM, André Warnier <[EMAIL PROTECTED]> wrote:

 Mikolaj Rydzewski wrote:
 jim ma wrote:
 I still want to know if it is possible to  stop Tomcat from
redirecting.
If
yes, that will be zero code effort for our current implementation.


 Why is it a problem for you to use http://localhost:8080/foo/ URL?
 I agree with the above, but in case it is not an option, you may want
to

look at something like this :

http://www.tuckey.org/urlrewrite/

It does many more things, but I guess it can rewrite "/foo" into "/foo/"
internally too.


 I  just debugged the code. It returns http status code 302 and redirected
location  http://localhost:8080/foo/ before reach the code related to url
rewrite configuration in web.xml .

 Yes, that's true of course. Stupid me.
Urlrewrite is a servlet filter, so it will not see the request before it
has been directed to the webapp, and thus the redirect will happen before.
Duh.
I guess you would need some kind of re-directing Valve for that.


I also try to add a rewrite Valve to StandardEngine. And it is also does not
work . Before reach that Valve, tomcat already replied that
redirect response.



Now, about what Mikolaj wrote before (using the /foo/ URL) I think you
misunderstand what he is saying.
What he meant is probably this :
You seem to be using a http client that is not a browser, but some kind of
program or module.  Can you not make sure that this program or module does
not send URLs like "/foo", but itself transforms them into "/foo/" at the
source ?


Yes , I can do that . If I get 302 response and write some code to resend
quest to the redirected location, then I can always get what I want . It is
not efficient , you know.  It needs to talk to tomcat server twice . Is
there shortcut way to do that ?

Yes : make it so that your *first* request contains the trailing "/".
In many words :
currently your "httpclient" sends a first request with the URL "/foo", and Tomcat then responds with a 302 to "/foo/". Can you not make it so that your "httpclient" sends the request for "/foo/" right away, the first time ? (then Tomcat would not need to send a 302, it would give you "/foo/" right away).

Or, in another way again : why does your httpclient send a first request "/foo" without the trailing "/" ?


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to