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

Double port in RestEasyClient-URI when using IPv6 and PathParam

    XMLWordPrintable

Details

    • Hide

      Running following Unit Test:

      *********************************************************************************
      TestClass RestEasyTestJava.java:
      -----------------------------------------------------------------------------------------------
      package com.commend.module;

      import com.commend.platform.junit.WeldTest;
      import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
      import org.junit.Test;

      import java.net.URI;
      import java.net.URISyntaxException;

      public class RestEasyTestJava extends WeldTest {

      @Test
      public void clientTest() {

      try

      { final URI uri = new URI("http://[::1]:8080"); final ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder(); final MyServiceJava proxy = clientBuilder.build().target(uri).proxy(MyServiceJava.class); proxy.get(2); }

      catch (final URISyntaxException e)

      { e.printStackTrace(); }

      }
      }
      -----------------------------------------------------------------------------------------------

      *********************************************************************************
      Interface MyServiceJava.java
      -----------------------------------------------------------------------------------------------
      package com.commend.module;

      import javax.ws.rs.Consumes;
      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      import javax.ws.rs.PathParam;

      @Path("/myservice")
      interface MyServiceJava {
      @GET
      @Path("/

      {id}

      ")
      @Consumes("text/json")
      void get(@PathParam("id") int id);
      }
      -----------------------------------------------------------------------------------------------

      Show
      Running following Unit Test: ********************************************************************************* TestClass RestEasyTestJava.java: ----------------------------------------------------------------------------------------------- package com.commend.module; import com.commend.platform.junit.WeldTest; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.junit.Test; import java.net.URI; import java.net.URISyntaxException; public class RestEasyTestJava extends WeldTest { @Test public void clientTest() { try { final URI uri = new URI("http://[::1]:8080"); final ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder(); final MyServiceJava proxy = clientBuilder.build().target(uri).proxy(MyServiceJava.class); proxy.get(2); } catch (final URISyntaxException e) { e.printStackTrace(); } } } ----------------------------------------------------------------------------------------------- ********************************************************************************* Interface MyServiceJava.java ----------------------------------------------------------------------------------------------- package com.commend.module; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @Path("/myservice") interface MyServiceJava { @GET @Path("/ {id} ") @Consumes("text/json") void get(@PathParam("id") int id); } -----------------------------------------------------------------------------------------------

    Description

      When using a Resteasy Client with a GET method function including a PathParam you receive a UriBuilderException because the resulting URI contains a double port:

      RESTEASY003330: Failed to create URI: http://[::1]:8080:8080/myservice/2
      javax.ws.rs.core.UriBuilderException: RESTEASY003330:
      Failed to create URI: http://[::1]:8080:8080/myservice/2

      It seems that "hostPortPattern" in "ResteasyUriBuilder" does not work for IPv6 addresses like "http://[::1]:8080"

      Attachments

        Issue Links

          Activity

            People

              rsearls r searls
              t.schweighofer Thomas Schweighofer (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: