You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dwebb <d....@dsl.pipex.com> on 2007/11/09 17:35:39 UTC
Tomcat and Redirects
Hi All,
I have a question about how Tomcat handles redirects. We have a vendor
who wrote an application for us and they tell us that they always use
the same method of issuing redirects in their code.
What we have seen is on certain requests from a WAP handset the
application will issue a redirect and Tomcat will issue it as an HTTP
302 redirect. On other handsets for some reason these same redirects
are issued as an HTTP 200 with an embedded link that the user has to
click on to redirect.
We believe this may be to the POST headers that the handset is sending
but haven't managed to narrow it down to which.
We would like all of these redirects to be done with the automatic 302
redirect.
Is there any way to force these redirects to be done with the HTTP 302?
We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp
Cheers,
Danny
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat and Redirects
Posted by Dwebb <d....@dsl.pipex.com>.
Hi Chris,
This is exactly the answer I was looking for. Thank you for your help.
Cheers,
Danny
On Sun, 2007-11-11 at 10:51 -0500, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bill,
>
> Bill Barker wrote:
> > Tomcat always sends a 302 redirect when response.sendRedirect(newURL); is
> > called. However, a lot of user-agents wrongly follow the redirect with a
> > GET when the initial request was a POST.
>
> Actually, this behavior is basically grandfathered-into the HTTP
> specification. See section 10.3.3 of the HTTP/1.1 spec:
>
> "If the 302 status code is received in response to a request other than
> GET or HEAD, the user agent MUST NOT automatically redirect the request
> unless it can be confirmed by the user, since this might change the
> conditions under which the request was issued.
>
> Note: RFC 1945 and RFC 2068 specify that the client is not allowed
> to change the method on the redirected request. However, most
> existing user agent implementations treat 302 as if it were a 303
> response, performing a GET on the Location field-value regardless
> of the original request method. The status codes 303 and 307 have
> been added for servers that wish to make unambiguously clear which
> kind of reaction is expected of the client.
> "
>
> Since the servlet specification does not say which redirection code
> should be used with response.sendRedirect (though it is pretty much
> always implemented as a 302), you will have to use response.setHeader
> and response.sendError with the code you prefer. I'm pretty sure you
> want to use either 303 or 307 and not 302 due to its inconsistent
> implementation.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHNyTx9CaO5/Lv0PARAgb6AKCI3eiqPBM2IQ8+XfUwxH4yNGT85QCeIGF2
> G1vMEtBhAU+nJVClTOPU9JQ=
> =7PAC
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat and Redirects
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Bill,
Bill Barker wrote:
> Tomcat always sends a 302 redirect when response.sendRedirect(newURL); is
> called. However, a lot of user-agents wrongly follow the redirect with a
> GET when the initial request was a POST.
Actually, this behavior is basically grandfathered-into the HTTP
specification. See section 10.3.3 of the HTTP/1.1 spec:
"If the 302 status code is received in response to a request other than
GET or HEAD, the user agent MUST NOT automatically redirect the request
unless it can be confirmed by the user, since this might change the
conditions under which the request was issued.
Note: RFC 1945 and RFC 2068 specify that the client is not allowed
to change the method on the redirected request. However, most
existing user agent implementations treat 302 as if it were a 303
response, performing a GET on the Location field-value regardless
of the original request method. The status codes 303 and 307 have
been added for servers that wish to make unambiguously clear which
kind of reaction is expected of the client.
"
Since the servlet specification does not say which redirection code
should be used with response.sendRedirect (though it is pretty much
always implemented as a 302), you will have to use response.setHeader
and response.sendError with the code you prefer. I'm pretty sure you
want to use either 303 or 307 and not 302 due to its inconsistent
implementation.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHNyTx9CaO5/Lv0PARAgb6AKCI3eiqPBM2IQ8+XfUwxH4yNGT85QCeIGF2
G1vMEtBhAU+nJVClTOPU9JQ=
=7PAC
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat and Redirects
Posted by Bill Barker <wb...@wilshire.com>.
"Dwebb" <d....@dsl.pipex.com> wrote in message
news:1194626139.6596.14.camel@liberate...
> Hi All,
>
> I have a question about how Tomcat handles redirects. We have a vendor
> who wrote an application for us and they tell us that they always use
> the same method of issuing redirects in their code.
>
> What we have seen is on certain requests from a WAP handset the
> application will issue a redirect and Tomcat will issue it as an HTTP
> 302 redirect. On other handsets for some reason these same redirects
> are issued as an HTTP 200 with an embedded link that the user has to
> click on to redirect.
>
> We believe this may be to the POST headers that the handset is sending
> but haven't managed to narrow it down to which.
>
> We would like all of these redirects to be done with the automatic 302
> redirect.
>
Tomcat always sends a 302 redirect when response.sendRedirect(newURL); is
called. However, a lot of user-agents wrongly follow the redirect with a
GET when the initial request was a POST. I'm guessing that your vendor has
some special code that is attempting to work around this.
> Is there any way to force these redirects to be done with the HTTP 302?
>
> We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp
>
> Cheers,
>
> Danny
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat and Redirects
Posted by Tony Fountain <tf...@benefitconcepts.com>.
Good point regarding the compatibility kit, that completely slipped my
mind :).
Thanks,
Tony
-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Friday, November 09, 2007 2:05 PM
To: Tomcat Users List
Subject: RE: Tomcat and Redirects
> From: Tony Fountain [mailto:tfountain@benefitconcepts.com]
> Subject: RE: Tomcat and Redirects
>
> Just to clarify, you can run Java programs compiled in 1.4, but the
> JVM installed on the machine running the app should be 1.5 or greater.
That's not true either. All you need to run Tomcat 5.5 on a 1.4 JVM is
the small compatibility kit available on the Tomcat download page.
Tomcat 5.5 works perfectly well on JRE 1.4.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
________________________________________________________________________
This Email has been scanned for all viruses by PAETEC Email Scanning
Services, utilizing MessageLabs proprietary SkyScan infrastructure. For
more information on a proactive anti-virus service working around the
clock, around the globe, visit http://www.paetec.com.
________________________________________________________________________
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat and Redirects
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tony Fountain [mailto:tfountain@benefitconcepts.com]
> Subject: RE: Tomcat and Redirects
>
> Just to clarify, you can run Java programs compiled in 1.4,
> but the JVM installed on the machine running the app should
> be 1.5 or greater.
That's not true either. All you need to run Tomcat 5.5 on a 1.4 JVM is
the small compatibility kit available on the Tomcat download page.
Tomcat 5.5 works perfectly well on JRE 1.4.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat and Redirects
Posted by Tony Fountain <tf...@benefitconcepts.com>.
Just to clarify, you can run Java programs compiled in 1.4, but the JVM
installed on the machine running the app should be 1.5 or greater. I'm
doing that now with a commercial app we purchased (Apache Tomcat 5.5.23,
JVM 1.5.0_12-b04 but the application itself is compiled under Java 1.4
and runs just fine.
Thanks,
Tony Fountain
Manager, Database Administration
Benefit Concepts, Inc.
(419) 244-9936 x9010 (office)
(419) 249-7221 (fax)
-----Original Message-----
From: Michael [mailto:sgfan@gmx.net]
Sent: Friday, November 09, 2007 1:45 PM
To: Tomcat Users List
Subject: Re: Tomcat and Redirects
Dwebb wrote:
> We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux
> 2.6.9-34.ELsmp
Hi Danny,
you shouldn't run tomcat 5.5.x with JAva 1.4.
It's designed to work with Java 5 and up.
bye
--
<NO> OOXML - Say NO To Microsoft Office broken standard
http://www.noooxml.org
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
________________________________________________________________________
This Email has been scanned for all viruses by PAETEC Email Scanning
Services, utilizing MessageLabs proprietary SkyScan infrastructure. For
more information on a proactive anti-virus service working around the
clock, around the globe, visit http://www.paetec.com.
________________________________________________________________________
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat and Redirects
Posted by Michael <sg...@gmx.net>.
Dwebb wrote:
> We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp
Hi Danny,
you shouldn't run tomcat 5.5.x with JAva 1.4.
It's designed to work with Java 5 and up.
bye
--
<NO> OOXML - Say NO To Microsoft Office broken standard
http://www.noooxml.org
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org