sending redirects to relative/absolute URLs

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

sending redirects to relative/absolute URLs

Angelov, Rossen
Hi,
Does anybody know why Tomcat always redirects to absolute links?

I looked at the implementation and the sendRedirect calls the toAbsolute
method which always constructs an absolute URL.
Is there any way to make Tomcat return relative URLs the way they were
requested for redirecting?

Ross


"This communication is intended solely for the addressee and is
confidential and not for third party unauthorized distribution."

Reply | Threaded
Open this post in threaded view
|

Re: sending redirects to relative/absolute URLs

Len Popp
No, because the HTTP protocol requires an absolute URL in redirect responses.

On 5/20/05, Angelov, Rossen <[hidden email]> wrote:

> Hi,
> Does anybody know why Tomcat always redirects to absolute links?
>
> I looked at the implementation and the sendRedirect calls the toAbsolute
> method which always constructs an absolute URL.
> Is there any way to make Tomcat return relative URLs the way they were
> requested for redirecting?
>
> Ross
>
>
> "This communication is intended solely for the addressee and is
> confidential and not for third party unauthorized distribution."

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sending redirects to relative/absolute URLs

Lutz Zetzsche
In reply to this post by Angelov, Rossen
Hi Angelov,

Am Freitag, 20. Mai 2005 15:53 schrieb Angelov, Rossen:
> Hi,
> Does anybody know why Tomcat always redirects to absolute links?
>
> I looked at the implementation and the sendRedirect calls the
> toAbsolute method which always constructs an absolute URL.
> Is there any way to make Tomcat return relative URLs the way they
> were requested for redirecting?

I would say that sendRedirect will set the HTTP header field "Location".
According to the specification of the "Hypertext Transfer Protocol --
HTTP/1.1" / RFC 2616, this field requires an absolute URL:

        "The field value consists of a single absolute URI."
        -> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30


Best wishes

Lutz

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: sending redirects to relative/absolute URLs

Angelov, Rossen
In reply to this post by Angelov, Rossen
Len,
Can you point me a place where I can read about these HTTP requirements?

I thought this might be the case but I couldn't find anything helpful
online. Probably didn't search enough.

-----Original Message-----
From: Len Popp [mailto:[hidden email]]
Sent: Friday, May 20, 2005 9:28 AM
To: Tomcat Users List
Subject: Re: sending redirects to relative/absolute URLs


No, because the HTTP protocol requires an absolute URL in redirect
responses.

On 5/20/05, Angelov, Rossen <[hidden email]> wrote:

> Hi,
> Does anybody know why Tomcat always redirects to absolute links?
>
> I looked at the implementation and the sendRedirect calls the toAbsolute
> method which always constructs an absolute URL.
> Is there any way to make Tomcat return relative URLs the way they were
> requested for redirecting?
>
> Ross
>
>
> "This communication is intended solely for the addressee and is
> confidential and not for third party unauthorized distribution."

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


"This communication is intended solely for the addressee and is
confidential and not for third party unauthorized distribution."

Reply | Threaded
Open this post in threaded view
|

Re: sending redirects to relative/absolute URLs

Jon Wingfield
Section 14.30 of the http spec. rfc2616

http://www.faqs.org/rfcs/rfc2616.html

Jon

Angelov, Rossen wrote:

> Len,
> Can you point me a place where I can read about these HTTP requirements?
>
> I thought this might be the case but I couldn't find anything helpful
> online. Probably didn't search enough.
>
> -----Original Message-----
> From: Len Popp [mailto:[hidden email]]
> Sent: Friday, May 20, 2005 9:28 AM
> To: Tomcat Users List
> Subject: Re: sending redirects to relative/absolute URLs
>
>
> No, because the HTTP protocol requires an absolute URL in redirect
> responses.
>
> On 5/20/05, Angelov, Rossen <[hidden email]> wrote:
>
>>Hi,
>>Does anybody know why Tomcat always redirects to absolute links?
>>
>>I looked at the implementation and the sendRedirect calls the toAbsolute
>>method which always constructs an absolute URL.
>>Is there any way to make Tomcat return relative URLs the way they were
>>requested for redirecting?
>>
>>Ross
>>
>>
>>"This communication is intended solely for the addressee and is
>>confidential and not for third party unauthorized distribution."
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> "This communication is intended solely for the addressee and is
> confidential and not for third party unauthorized distribution."
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]