Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2212

Provide getUri() of client proxy method

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • None
    • jaxrs

      I use the resteasy client proxy method to invoke restful services by a proxy interface:

      Client client = ClientFactory.newClient();
      // path is an empty string as it is already declared in proxy interface
      ResteasyWebTarget target = (ResteasyWebTarget) client.target("");
      UserClient userClient = target.proxy(UserClient.class);
      userClient.getName("hello world");
      // unfortunately, no way to get the actual request uri:
      // the returned uri does not consider the proxy call of "userClient.getName()"
      log.info(target.getUri()); 
      

      with

      @Path("http://example.com/base/uri")
      public interface UserClient
      {
         @GET
         @Path("name")
         @Produces("text/plain")
         Response getName(QueryParam("test") String test);
      
      ..}
      

      It is actually not possible to get the full request-uri. After invoking proxy-method

      getName("hello world")

      the resolved URI must be

      http://example.com/base/uri/name?test="hello world

      Please provde a method to get the resolved URI by calling

      target.getUri()

      after the interface proxy call.

      At least, provide the resolved URI as a getter within the Response-Object, for example, by something like:

      response.getResolvedUri()
      

      or

      response.getRequestUri()
      

      or the best solution would be, to make the requested URI accessible by putting it into the key of a Map:

      @Path("http://example.com/base/uri")
      public interface UserClient
      {
         @GET
         @Path("name")
         @Produces("text/plain")
         // If Map is used, Resteasy can put automatically the requested URI as key, and the respond as the value
         Map<URI, User> getName(QueryParam("test") String test);
      
      ..}
      

              dkafe Dimitris Kafetzis
              nimo22 nimo stephan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: