jersey
  1. jersey
  2. JERSEY-533

UriBuilder incorrectly encoding Query Parameters value

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0
    • Component/s: core
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      533

      Description

      Following code sample where a path and single parameter are encoded...

      Parameter name: "param"
      Parameter value: "foo/bar?aaa=bbb&ccc=ddd" (happens to be a url with query parameters)

      String test = UriBuilder.fromPath("https://dummy.com").
      queryParam("param", "foo/bar?aaa=bbb&ccc=ddd").
      build().toURL().toString();

      The encoded URL string returned is:

      "https://dummy.com?param=foo/bar?aaa%3Dbbb&ccc%3Dddd"

      Character "&" (and "?") are not encoded in the parameter value string.
      The URL produced would be interpreted as follow:

      One first parameter, name="param", value = "ar?aaa%3Dbbb" followed by a second parameter,
      name="ccc%3Dddd", without value.

        Activity

        Hide
        sandoz added a comment -

        This is fixed in Jersey 1.0.1 (issue 146) and greater.

        The following URI will be built:

        https://dummy.com?param=foo/bar?aaa%3Dbbb%26ccc%3Dddd

        The '?' character does not need to be percent encoded as per the encoding rules
        of the URI specification.

            • This issue has been marked as a duplicate of 146 ***
        Show
        sandoz added a comment - This is fixed in Jersey 1.0.1 (issue 146) and greater. The following URI will be built: https://dummy.com?param=foo/bar?aaa%3Dbbb%26ccc%3Dddd The '?' character does not need to be percent encoded as per the encoding rules of the URI specification. This issue has been marked as a duplicate of 146 ***

          People

          • Assignee:
            jersey-issues
            Reporter:
            fredsalles
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: