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

RestEasyUriBuilder.host does not accept null to reset host per JavaDoc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 3.0.4.Final, 3.0.10.Final
    • jaxrs
    • None
    • Hide

      @Inject UriInfo uriInfo;
      uriInfo.getRequestUriBuilder().scheme(null).host(null).port(-1);

      Show
      @Inject UriInfo uriInfo; uriInfo.getRequestUriBuilder().scheme(null).host(null).port(-1);
    • Compatibility/Configuration

    Description

      The JavaDoc for UriBuilder.host states that "A null value will unset the host component of the URI",
      however the ResteasyUriBuilder throws IllegalArgumentException "schemeSpecificPart was null" when host value is null.

      This is useful to create a relative URI for the request.

      The fix only changed the

          @Test
          public void shouldDeleteHostWhenSettingToNull() {
              UriBuilder builder = UriBuilder.fromUri("http://example.org/path");
      
              builder.host(null);
      
              assertEquals("http:/path", builder.build().toString());
          }
      

      Attachments

        Issue Links

          Activity

            People

              patriot1burke@gmail.com Bill Burke (Inactive)
              ruediger.dohna@codecentric.de RĂ¼diger zu Dohna
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: