You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Sebastian R. Wain" <se...@nektra.com> on 2008/07/01 16:38:13 UTC

Multiple consecutive slashes not normalized in URI's path?

Hi,

I see a different behaviour between org.apache.commons.httpclient.URI 
and java.net.URI normalization.
Jython transcript:

    >>> uri1 = 
org.apache.commons.httpclient.URI("http://www.domain.org//a//b//c//")

    >>> uri1.normalize()
    >>> uri1
    http://www.domain.org//a//b//c//
    >>> uri2 = java.net.URI("http://www.domain.org//a//b//c//")
    >>> uri2.normalize()
    http://www.domain.org/a/b/c/

What is the correct way to handle URI's path with multiple slashes? I 
need to remove it myself? The problem arises when you want to compare 
two different URIs and there is a need for some canonical representation.

Thanks,
Seb

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


Re: Multiple consecutive slashes not normalized in URI's path?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-07-01 at 11:38 -0300, Sebastian R. Wain wrote:
> Hi,
> 
> I see a different behaviour between org.apache.commons.httpclient.URI 
> and java.net.URI normalization.
> Jython transcript:
> 
>     >>> uri1 = 
> org.apache.commons.httpclient.URI("http://www.domain.org//a//b//c//")
> 
>     >>> uri1.normalize()
>     >>> uri1
>     http://www.domain.org//a//b//c//
>     >>> uri2 = java.net.URI("http://www.domain.org//a//b//c//")
>     >>> uri2.normalize()
>     http://www.domain.org/a/b/c/
> 
> What is the correct way to handle URI's path with multiple slashes? 

Sebastian,

o.a.c.httpclient.URI has been removed in favor of j.n.URI in HttpClient
4.0. Go with j.n.URI.

Oleg

> I 
> need to remove it myself? The problem arises when you want to compare 
> two different URIs and there is a need for some canonical representation.
> 
> Thanks,
> Seb
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


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