Multiple consecutive slashes not normalized in URI's path?

View: New views
2 Messages — Rating Filter:   Alert me  

Multiple consecutive slashes not normalized in URI's path?

by Sebastian R. Wain :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: httpclient-users-help@...


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

by olegk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
> For additional commands, e-mail: httpclient-users-help@...
>


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