You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Andreas Schaefer Sr." <sc...@me.com> on 2017/06/23 01:37:45 UTC

SlingClient is removing double / triple slashes from the URL

Hi

If I call a SlingClient this way:

slingClient.doGet(“/api/test/move.json//path///content/test//to///content/new-test”, 200)

Then what is called is:

“/api/test/move.json/path/content/test/to/content/new-test”

and hence the call fails.

Is there a way to fix that like sub-classing SlingClient and then override doStreamGet() ?

Thanks - Andy

Re: SlingClient is removing double / triple slashes from the URL

Posted by Andrei Dulvac <an...@gmail.com>.
Hi Andreas,

Funny it's not covered by the unit test:
https://github.com/apache/sling/blob/trunk/testing/http/clients/src/test/java/org/apache/sling/testing/AbstractSlingClientGetPathTest.java#L37

The magic happens here:
https://github.com/apache/sling/blob/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/AbstractSlingClient.java#L137

But yeah, I'd also recommend not relying on multiple slashes.

- Andrei

On Fri, Jun 23, 2017 at 10:02 AM Roy Teeuwen <ro...@teeuwen.be> wrote:

> Hey Andreas,
>
> I wouldn't go relying on double and triple slashes too much, I already
> have written a few classes that did at the beginning also to use it in
> suffixes, but I had to change it because it wasn't workable (in AEM for
> example the Link checker kept removing the slashes in the rendered html)
>
> Greets,
> Roy
> > On 23 Jun 2017, at 03:37, Andreas Schaefer Sr. <sc...@me.com> wrote:
> >
> > Hi
> >
> > If I call a SlingClient this way:
> >
> >
> slingClient.doGet(“/api/test/move.json//path///content/test//to///content/new-test”,
> 200)
> >
> > Then what is called is:
> >
> > “/api/test/move.json/path/content/test/to/content/new-test”
> >
> > and hence the call fails.
> >
> > Is there a way to fix that like sub-classing SlingClient and then
> override doStreamGet() ?
> >
> > Thanks - Andy
>
>

Re: SlingClient is removing double / triple slashes from the URL

Posted by Roy Teeuwen <ro...@teeuwen.be>.
Hey Andreas,

I wouldn't go relying on double and triple slashes too much, I already have written a few classes that did at the beginning also to use it in suffixes, but I had to change it because it wasn't workable (in AEM for example the Link checker kept removing the slashes in the rendered html)

Greets,
Roy
> On 23 Jun 2017, at 03:37, Andreas Schaefer Sr. <sc...@me.com> wrote:
> 
> Hi
> 
> If I call a SlingClient this way:
> 
> slingClient.doGet(“/api/test/move.json//path///content/test//to///content/new-test”, 200)
> 
> Then what is called is:
> 
> “/api/test/move.json/path/content/test/to/content/new-test”
> 
> and hence the call fails.
> 
> Is there a way to fix that like sub-classing SlingClient and then override doStreamGet() ?
> 
> Thanks - Andy