Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-770

org.apache.hc.core5.net.URIBuilder - Allow to configure plusAsBlank

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.3
    • 5.4-alpha1
    • HttpCore
    • None

    Description

      When upgrading from Http Client v4 to v5 then the URIBuilder has changed a default value for the plusAsBlank option.

       

      In v4 the default is true

       

      org.apache.http.client.utils.URLEncodedUtils.decodeFormFields()
      ~~~
      return urlDecode(content, charset != null ? charset : Consts.UTF_8, true);
      ~~~

      In v5 the default is changed to false

      org.apache.hc.core5.net.URIBuilder.digestURI()
      ~~~
      this.queryParams = parseQuery(uri.getRawQuery(), charset, false);
      ~~~

       

      I wonder if the URIBuilder could have some kind of flag that can be set to set whether to use true or false.

       

      import org.apache.hc.core5.http.NameValuePair;
      import org.apache.hc.core5.http.message.BasicNameValuePair;
      import org.apache.hc.core5.net.URIBuilder;

       

              URIBuilder uriBuilder;
              uriBuilder = new URIBuilder("http://dummy/demo+demo?sample=sample+sample");
              LOG.info("uri="+uriBuilder.toString());
              List<NameValuePair> queryParameters = uriBuilder.getQueryParams();
              queryParameters.add(new BasicNameValuePair("Greeting", "hello"));
              uriBuilder.setParameters(queryParameters);
              LOG.info("uri="+uriBuilder.toString());

      Attachments

        Activity

          People

            Unassigned Unassigned
            davsclaus Claus Ibsen
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 50m
                50m