Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1110543

Summary: Subresources locators doesn't work with RESTEasy client API and ProxyFactory
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: William Antônio <wsiqueir>
Component: RESTEasyAssignee: Ron Sigal <rsigal>
Status: CLOSED WONTFIX QA Contact: Katerina Odabasi <kanovotn>
Severity: medium Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.2.0CC: bmaxwell, wsiqueir
Target Milestone: ---   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-21 13:28:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The reproducer for this issue none

Description William Antônio 2014-06-17 21:54:10 UTC
Description of problem:

Subresource locators are described in RESTEasy documentation[1]. It works on server side, however, when generating the client proxies with Proxyfactory, it doesn't work as expected. The following should generate a GET request on 


        @Path("resource")
        interface Resource{
                @Path("sub")
                public SubResource go();    
        }   

        interface SubResource {
                @GET
                public String goSub();
        }

Resource resource = crf.createProxy(Resource.class);
resource.go().goSub();

Will generate a GET on /sub, when it should generate a get on /resource/sub.

The JIRA [2] is also about the same issue. If this is a RESTEasy limitation, I believe it should be documented in [3].

[1] https://docs.jboss.org/resteasy/docs/2.3.7.Final/userguide/html/JAX-RS_Resource_Locators_and_Sub_Resources.html
[2] https://issues.jboss.org/browse/RESTEASY-772
[3] https://docs.jboss.org/resteasy/docs/2.3.7.Final/userguide/html/RESTEasy_Client_Framework.html#Sharing_interfaces
Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 William Antônio 2014-06-17 21:57:53 UTC
I forgot to add the steps to reproduce:

* Refer to the attachment "resteasy-sub-resources-client", download and unzip it;
* Start EAP 6.2
* cd to the attachment directory and eploy it using maven:

mvn package jboss-as:deploy -Dmaven.test.skip=true

* run test to see the request being done:

mvn test

* if you look at the JBoss logs, it will show that the request was made to the /sub URI

Comment 2 William Antônio 2014-06-17 21:58:37 UTC
Created attachment 909780 [details]
The reproducer for this issue

Comment 3 Katerina Odabasi 2014-08-13 13:44:37 UTC
Issue reproducible on EAP 6.3.0.GA as well.

Comment 4 Ron Sigal 2014-10-06 23:14:27 UTC
As I just noted on RESTEASY-772: 

When an org.jboss.resteasy.client.core.SubResourceInvoker is created, it stores the base URI, and, for each method, it gets the path from the @Path annotation. Then the invoke method calls

  ProxyBuilder.createProxy(iface, ProxyFactory.createUri(base + path), config);

So, the basie URI should include the value of the interface's @Path parameter. The example in the documentation doesn't show that because the interface doesn't have a @Path parameter, just the methods do.

When I change the value of url in SubResourceClientTest to "http://localhost:8080/resteasy-sub-resources-client/rest/resource", the example runs fine.

Comment 5 Ron Sigal 2014-10-24 01:04:14 UTC
I didn't get any feedback on RESTEASY-772, so I rejected and closed it.