You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by faheem farhan <fa...@gmail.com> on 2011/02/24 16:20:12 UTC

Re: Response.SendRedirect problems

Hi Ashwin

I am too facing the same issue now , On redirection the port number is
getting omitted, Since this is a 2 years back thread, I suppose you might
have got the solution, Please reply back with the solution.

thanks
faheem



ashwin soorkeea wrote:
> 
> 
> Hello all,
>  
> I have a problem for my application and this prob is causing an entire
> netw=
> ork of users from using my application. I will appreciate
> if you guys can help me solve my prob.
>  
> 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. I want it to
> b=
> e handle by the browser keeping it relative throughout
> the application. I know it's possible, but i dunno how to do it. Can you
> he=
> lp ?=20
>  
> The URL reconstruction by the servlet engine during a redirection is
> causin=
> g some problems in my application.
>  
> 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.
> On the other hand, i have another application that is interconnected, but
> i=
> n this application, the url is relative throughout, even though
> it passes through the response.sendRedirect(...) and consequently, i do
> not=
>  have this prob in this application.
>  
> Im using tomcat-4.1 and i'm checking the URL redirection using the HTTP
> liv=
> e header plugins for firefox.
>  
> Thank you for your help.
> Regards,
> Ashwin
> _________________________________________________________________
> i’m is proud to present Cause Effect, a series about real people making a
> difference.
> http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect
> 

-- 
View this message in context: http://old.nabble.com/Response.SendRedirect-problems-tp14361975p31005032.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Response.SendRedirect problems

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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


Re: Response.SendRedirect problems

Posted by Konstantin Kolinko <kn...@gmail.com>.
>> 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.

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


2011/2/24 faheem farhan <fa...@gmail.com>:
>
> Hi Ashwin
>
> I am too facing the same issue now , On redirection the port number is
> getting omitted, Since this is a 2 years back thread, I suppose you might
> have got the solution, Please reply back with the solution.
>
> thanks
> faheem
>
>
>
> ashwin soorkeea wrote:
>>
>>
>> Hello all,
>>
>> I have a problem for my application and this prob is causing an entire
>> netw=
>> ork of users from using my application. I will appreciate
>> if you guys can help me solve my prob.
>>
>> 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. I want it to
>> b=
>> e handle by the browser keeping it relative throughout
>> the application. I know it's possible, but i dunno how to do it. Can you
>> he=
>> lp ?=20
>>
>> The URL reconstruction by the servlet engine during a redirection is
>> causin=
>> g some problems in my application.
>>
>> 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.
>> On the other hand, i have another application that is interconnected, but
>> i=
>> n this application, the url is relative throughout, even though
>> it passes through the response.sendRedirect(...) and consequently, i do
>> not=
>>  have this prob in this application.
>>
>> Im using tomcat-4.1 and i'm checking the URL redirection using the HTTP
>> liv=
>> e header plugins for firefox.
>>
>> Thank you for your help.
>> Regards,
>> Ashwin
>> _________________________________________________________________
>> i’m is proud to present Cause Effect, a series about real people making a
>> difference.
>> http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect
>>
>
> --
> View this message in context: http://old.nabble.com/Response.SendRedirect-problems-tp14361975p31005032.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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