tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Response.SendRedirect problems
Date Fri, 25 Feb 2011 19:18:50 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 2/25/2011 4:11 AM, Konstantin Kolinko wrote:
>>> It concerns the servlet response.sendRedirect(...) method.
>>>
>>> When using the response.sendRedirect("/myexample") in my java class, i do
>>> n=
>>> ot want the servlet engine to reconstruct
>>> an absolute URL, before sending the response to the browser.
> 
> That is not possible, because of how HTTP spec is written.

It's probably not possible using response.sendRedirect, but it should be
possible using response.setStatus(302) (or whatever response code you
want) and response.setHeader("Location", "/myexample").

Note that this violates the HTTP spec
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30) which
says that the Location response header is fully-qualified.

>> On redirection the port number is getting omitted
> 
> You should describe your configuration in detail first.  Though I
> think you miss "proxyPort" attribute on a connector.  (IIRC, it should
> not be necessary for AJP though).

Faheem, you can't have a relative "Location" that includes a port
number: that will require an absolute (fully-qualified) URI. If Tomcat
is incorrectly (or not at all) inserting the port number into the
Location field, please let me know.

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

iEYEARECAAYFAk1oAJoACgkQ9CaO5/Lv0PDgLQCfQC5cFLCkNogWKxQeuldECaQk
+wUAn06iE5pAYxhKA8Nj7eKh3HFbP8BO
=ZMum
-----END PGP SIGNATURE-----

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


Mime
View raw message