You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Liviu Ionescu <il...@livius.net> on 2004/03/24 12:51:12 UTC

RE: method="post" but doGet() called -> external redirects

> When Tomcat sees a request for 
> 'http://localhost:8080/mycontext' it sends back a response to 
> redirect to 'http://localhost:8080/mycontext/'.  This is so 
> that relative links to things like images and stylesheets 
> work correctly. If the browser conformed to the HTTP/1.1 RFC, 
> it would re-request the new URL with a POST, but I don't know 
> of any browsers that do this.

would it be possible to add a configuration parameter to certain contexts so
that the external redirects are replaced by internal forwardings?

I have a m2m application where the clients are not browsers, but simple
dedicated devices that do not implement redirects, and their standard way of
accessing the server is .../mycontext?x=a, so without a trailing '/'.

Since I could not find a url rewrite mechanism, like in Apache, I had to use
a dirty trick, I renamed my context to mycontext-app and I wrote a servlet
in the root context to forward requests from "/mycontext" to
"/mycontext-app/" (beware that .forward() is usually called in the current
context, if another context is needed it should be retrieved first)

having the rewrite done directly by Tomcat (is the DefaultServlet handling
this?) would be a more appropriate solution, imho.

regards,

Liviu


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org