<div dir="ltr">I can&#39;t change how it works, since i am only the client and don&#39;t control the server side. The server side is a RH/JBoss project:<div><ul><li><a href="https://github.com/hawkular/hawkular-inventory" target="_blank">https://github.com/hawkular/<wbr>hawkular-inventory</a><br></li></ul><div>Since the code currently supports deciding whether to encode the slash or not, i&#39;ve raised a PR [1].</div></div><div><br></div><div>[1] <a href="https://github.com/resteasy/Resteasy/pull/945">https://github.com/resteasy/Resteasy/pull/945</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 5:28 PM, Rebecca Searls <span dir="ltr">&lt;<a href="mailto:rsearls@redhat.com" target="_blank">rsearls@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
As you have noted there is no simple clean way to alter this processing behavior.<br>
When it is this difficult and complex to control the processing behavior you<br>
desire, its an strong indication that you are attempting to use a feature outside<br>
its defined bounds and your implementation would be considered a bad code practice,<br>
fraught with potential maintenance nightmares.<br>
<br>
I strongly recommend you stop and reevaluate the problem you are attempting<br>
to solve and seek a means of addressing it in a way that is considered a standard<br>
practice.<br>
<br>
If you absolutely must proceed down this solution path then you would need<br>
to provide your own javax.ws.rs.core.URIBuilder implementation and pass it<br>
to the ProxyBuilder as a target.<br>
<br>
      CustomURIBuilder cBuilder = new CustomURIBuilder();<br>
<br>
        ProxyBuilder&lt;T&gt; proxyBuilder = client<br>
            .target(cBuilder.uri(uri))<br>
            //.target(uri)<br>
            .proxyBuilder(apiClassType);<br>
<br>
After looking at the code you might think that you can extend Resteasy&#39;s<br>
URIBuilder implementation and override one of the resolveTemplates methods<br>
but there are several problems with that.<br>
<br>
  - Overriding resolveTemplates method will not work because these methods<br>
      call method buildString, which is private.<br>
  - javax.ws.rs.core.URIBuilder is an abstract class that uses<br>
      RuntimeDelegate.getInstance().<wbr>createUriBuilder() in a handful of methods<br>
      for creating a UriBuilder object.  In Resteasy the RuntimeDelegate is<br>
      tied to ResteasyProviderFactory so you can not use methods newInstance,<br>
      fromUri, fromPath, fromResource, fromMethod because they will return<br>
      Resteasy&#39;s implementation class not yours.<br>
  - You will not be able to override URiBuilder.newInstance to avoid access to<br>
      RuntimeDelegate because it is a static method.  You don&#39;t want to replace<br>
      Resteasy&#39;s RuntimeDelegate because then you will break Resteasy itself.<br>
<br>
<br>
So now that we have discussed what you don&#39;t want to do and what you can&#39;t do<br>
lets consider other options.<br>
<br>
URI variables &quot;{path}&quot; can be matched by a regular expression &quot;[^/]+?&quot;.  There are<br>
a variety of web sites that discuss this.  The disadvantage to this solution is<br>
the more unrestricted a string you want to support the more complicated the the<br>
expression may be.  This could cause long term maintenance issues.<br>
<br>
Use the URI variable as it is intended, in particular don&#39;t embed a forward slack in the value<br>
and use another methodology to process the path.  Here is a post with some good suggests,<br>
<a href="http://stackoverflow.com/questions/17000193/can-we-have-more-than-one-path-annotation-for-same-rest-method" rel="noreferrer" target="_blank">http://stackoverflow.com/<wbr>questions/17000193/can-we-<wbr>have-more-than-one-path-<wbr>annotation-for-same-rest-<wbr>method</a><br>
<br>
Don&#39;t pass the &quot;path&quot; information as a URI variable.  Pass it as a QueryParam to<br>
your REST method, and process it internally.<br>
<span class="im HOEnZb"><br>
<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Rebecca Searls&quot; &lt;<a href="mailto:rsearls@redhat.com">rsearls@redhat.com</a>&gt;<br>
&gt; To: &quot;Gareth Healy&quot; &lt;<a href="mailto:garethahealy@gmail.com">garethahealy@gmail.com</a>&gt;<br>
&gt; Cc: <a href="mailto:resteasy@lists.jboss.org">resteasy@lists.jboss.org</a><br>
</span><div class="HOEnZb"><div class="h5">&gt; Sent: Friday, September 16, 2016 7:34:46 AM<br>
&gt; Subject: Re: [resteasy] Client escapes slashes causing failure<br>
&gt;<br>
&gt; I&#39;m putting together an example of how to override the &quot;encodeSlash&quot; setting.<br>
&gt; Should be available later today.<br>
&gt;<br>
&gt;<br>
&gt; ----- Original Message -----<br>
&gt; &gt; From: &quot;Gareth Healy&quot; &lt;<a href="mailto:garethahealy@gmail.com">garethahealy@gmail.com</a>&gt;<br>
&gt; &gt; To: &quot;Rebecca Searls&quot; &lt;<a href="mailto:rsearls@redhat.com">rsearls@redhat.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:resteasy@lists.jboss.org">resteasy@lists.jboss.org</a><br>
&gt; &gt; Sent: Friday, September 16, 2016 4:27:27 AM<br>
&gt; &gt; Subject: Re: [resteasy] Client escapes slashes causing failure<br>
&gt; &gt;<br>
&gt; &gt; Just digging into this a bit more, i can see the param processor is loaded<br>
&gt; &gt; [1] which calls the web target [2], but this calls an overload which always<br>
&gt; &gt; passes in true for &quot;encodeSlash&quot;.<br>
&gt; &gt;<br>
&gt; &gt; [1] <a href="https://github.com/resteasy/Resteasy/blob/master/resteasy-" rel="noreferrer" target="_blank">https://github.com/resteasy/<wbr>Resteasy/blob/master/resteasy-</a><br>
&gt; &gt; client/src/main/java/org/<wbr>jboss/resteasy/client/jaxrs/<br>
&gt; &gt; internal/proxy/processors/<wbr>webtarget/PathParamProcessor.<wbr>java<br>
&gt; &gt; [2] <a href="https://github.com/resteasy/Resteasy/blob/master/resteasy-" rel="noreferrer" target="_blank">https://github.com/resteasy/<wbr>Resteasy/blob/master/resteasy-</a><br>
&gt; &gt; client/src/main/java/org/<wbr>jboss/resteasy/client/jaxrs/<br>
&gt; &gt; internal/ClientWebTarget.java#<wbr>L134<br>
&gt; &gt; [3] <a href="https://github.com/resteasy/Resteasy/blob/master/resteasy-" rel="noreferrer" target="_blank">https://github.com/resteasy/<wbr>Resteasy/blob/master/resteasy-</a><br>
&gt; &gt; jaxrs/src/main/java/org/jboss/<wbr>resteasy/specimpl/<br>
&gt; &gt; ResteasyUriBuilder.java#L1085<br>
&gt; &gt;<br>
&gt; &gt; The param processor is created by the factory [4] so i can&#39;t see how to<br>
&gt; &gt; change the default behaviour.<br>
&gt; &gt;<br>
&gt; &gt; [4]<br>
&gt; &gt; <a href="https://github.com/resteasy/Resteasy/blob/master/resteasy-client/src/main/java/org/jboss/resteasy/client/jaxrs/internal/proxy/processors/ProcessorFactory.java" rel="noreferrer" target="_blank">https://github.com/resteasy/<wbr>Resteasy/blob/master/resteasy-<wbr>client/src/main/java/org/<wbr>jboss/resteasy/client/jaxrs/<wbr>internal/proxy/processors/<wbr>ProcessorFactory.java</a><br>
&gt; &gt;<br>
&gt; &gt; On Thu, Sep 15, 2016 at 9:54 AM, Gareth Healy &lt;<a href="mailto:garethahealy@gmail.com">garethahealy@gmail.com</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; &gt; I&#39;ve added a simple unit test which shows the behaviour @<br>
&gt; &gt; &gt; <a href="https://github.com/garethahealy/resteast-pathparam-escape" rel="noreferrer" target="_blank">https://github.com/<wbr>garethahealy/resteast-<wbr>pathparam-escape</a><br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Contains 1 test, which uses a ClientRequestFilter to check what the URI<br>
&gt; &gt; &gt; is, if it contains &quot;%2F&quot;, then it fails.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Cheers.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Wed, Sep 14, 2016 at 8:01 PM, Rebecca Searls &lt;<a href="mailto:rsearls@redhat.com">rsearls@redhat.com</a>&gt;<br>
&gt; &gt; &gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; If you replace RelativePath with String do you have the same issue?<br>
&gt; &gt; &gt;&gt; What RelativePath class are you using?<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; ----- Original Message -----<br>
&gt; &gt; &gt;&gt; &gt; From: &quot;Gareth Healy&quot; &lt;<a href="mailto:garethahealy@gmail.com">garethahealy@gmail.com</a>&gt;<br>
&gt; &gt; &gt;&gt; &gt; To: <a href="mailto:resteasy@lists.jboss.org">resteasy@lists.jboss.org</a><br>
&gt; &gt; &gt;&gt; &gt; Sent: Wednesday, September 14, 2016 11:36:31 AM<br>
&gt; &gt; &gt;&gt; &gt; Subject: [resteasy] Client escapes slashes causing failure<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; I have a client which uses the following method:<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; @GET<br>
&gt; &gt; &gt;&gt; &gt; @Path(&quot;/{path}/treeHash&quot;)<br>
&gt; &gt; &gt;&gt; &gt; Response getEntityHash(@PathParam(&quot;<wbr>path&quot;) RelativePath path);<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; The RelativePath object gets converted into a value of:<br>
&gt; &gt; &gt;&gt; &gt; t;unit-testing/e;ua2shhq9<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; Example full URL: /entity/t;unit-testing/e;<wbr>ua2shhq9/treeHash<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; When its executed, the forward slash is converted to %2F (encoded /).<br>
&gt; &gt; &gt;&gt; This<br>
&gt; &gt; &gt;&gt; &gt; causes the call to fail. What do i need to do, to make sure its not<br>
&gt; &gt; &gt;&gt; &gt; URL<br>
&gt; &gt; &gt;&gt; &gt; encoded?<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; I&#39;ve tried adding @Encoded, but that has no effect.<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; Cheers.<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; ______________________________<wbr>_________________<br>
&gt; &gt; &gt;&gt; &gt; resteasy mailing list<br>
&gt; &gt; &gt;&gt; &gt; <a href="mailto:resteasy@lists.jboss.org">resteasy@lists.jboss.org</a><br>
&gt; &gt; &gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/resteasy" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/resteasy</a><br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; ______________________________<wbr>_________________<br>
&gt; resteasy mailing list<br>
&gt; <a href="mailto:resteasy@lists.jboss.org">resteasy@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/resteasy" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/resteasy</a><br>
&gt;<br>
</div></div></blockquote></div><br></div>