Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9220

RestTemplate support for URL elements that can contain { } characters

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Works as Designed
    • Affects Version/s: 3.1.1
    • Fix Version/s: None
    • Component/s: Web
    • Labels:

      Description

      The following issue was observed when working with Apache Solr, which has a query function syntax of query parameter values declared within bracket {} delimiters. For example:

      http://localhost:8983/solr/select?wt=json&indent=true&fl=*&q=*:*&fq=

      {!geofilt}

      &sfield=venue_location&pt=28.0674,-80.5595&d=25.

      Calling restTemplate.getForObject(String, Class<T>) and manually escaping

      { and }

      with %7B and %7D doesn't work because the escaping gets applied twice. Leaving the { } characters as-is doesn't work as the parameter value is treated as a URI variable.

      Present workaround seems to construct a URI instead of passing in a url String. Wanted to submit this issue for documentation and see if it's possible to add enhanced support for cases like this.

        Attachments

          Activity

            People

            • Assignee:
              rstoya05-aop Rossen Stoyanchev
              Reporter:
              kdonald Keith Donald
              Last updater:
              Rossen Stoyanchev
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 35 weeks, 6 days ago