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

Double port in RestEasyClient-URI when using IPv6 and PathParam

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Done
    • Affects Version/s: 3.1.4.Final
    • Fix Version/s: 4.0.0.Beta1
    • Component/s: CDI Integration, jaxrs
    • Labels:
      None
    • Environment:

      Ubuntu 16.04, Oracle JDK 8, Resteasy 3.1.4, Developing in Intellij 2017.2, Undertow Server 1.4.20 Final, 3.0.0 Final

    • Steps to Reproduce:
      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"

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rsearls R Searls
                  Reporter:
                  t.schweighofer Thomas Schweighofer
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: