-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Askwin,

ashwin soorkeea wrote:
> When using the response.sendRedirect("/myexample") in my java class,
> i do not want the servlet engine to reconstruct an absolute URL,
> before sending the response to the browser.

This request violates the servlet specification. From the 2.4 spec:

"SRV.5.3 Convenience Methods

The following convenience methods exist in the HttpServletResponse
interface:

• sendRedirect
• sendError

The sendRedirect method will set the appropriate headers and content
body to redirect the client to a different URL. It is legal to call this
method with a relative URL path, however the underlying container must
translate the relative path to a fully qualified URL for transmission
back to the client. If a partial URL is given and, for whatever reason,
cannot be converted into a valid URL, then this method must throw an
IllegalArgumentException.
"

> I want it to be [handled] by the browser keeping it relative throughout
> the application. I know it's possible, but i dunno how to do it. Can you help?

Why do you care? The browser needs an absolute URL to contact the
server, anyway, so it shouldn't matter.

Let me guess... you want to use URLs like "../somewhere/else" all over
the place. This is a management headache. It's much better to root
everything in "contextPath + relativeURL", especially because that's how
/everybody/ does it, and it's compatible with the servlet specification.

> Example:
> I have this link on browser http://127.0.0.1:<port_number>, when
> performing= a sendRedirect, i'm losing the <port_number> during the
> url reconstruction by the servlet engine.

Really? Can you post a servlet or JSP that fails in this way?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHZcYw9CaO5/Lv0PARAkYtAJ9GTMtUfh/SW/eSPp/eywG95U4OXQCfWokc
hCU05p3hc4Mx8Q9AlX1jlN4=
=B4HL
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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