Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4861

Encoding issue jax-rs - UriBuilder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6, 2.7
    • 2.7.4, 2.6.7, 3.0.0-milestone1
    • None
    • None
    • Unknown

    Description

      Use Case: OData (odata.org) / odata4j (odata4j.org)

      Building an URI based on OData query parameter:

      URI called by http client: .../Employees?$filter=startswith(CarrierId,'A')

      URI build on server:

      String nextHref = uriInfo.getRequestUriBuilder().replaceQueryParam("$skiptoken", "

      {dummySkipToken}

      ").build().toString();

      Result is:

      /Employees?$filter=startswith%2528CarrierId%252C%2527A%2527%2529&$skiptoken=%7BdummySkipToken%7D

      The value of query parameter $filter is encoded twice. The issue is in the embrasing {} of the value of the $skiptoken query parameter.

      CXF does a partial encoding of the first query parameter which succeeds and then gets a UriSyntaxException for the 2nd query parameter. After that it falls back and encodes the whole URI while the 1st query option is already encoded.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            klevenzs Stephan Klevenz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: