Announcement Announcement Module
No announcement yet.
Possible bug in RestTemplate - double checking before opening a JIRA Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible bug in RestTemplate - double checking before opening a JIRA

    I'm trying to consume a somewhat non-standard type of URI of a RESTful web service (built with Spring MVC) via the RestTemplate - an example of this is:
    So, the parameter should be:
    name = `q`
    value = `name=jDiedXRD`
    The value is definitly non-standard, but as far as I can tell from the HTTP spec, it's not prohibited. Also, the same exact HTTP requests work fine with other HTTP Clients (rest-assured wich is using Apache HTTP Client underneath, same as RestTemplate is).
    Now, what RestTemplate does is this:
    HttpUrlTemplate it uses tries to parse the URI into UriComponents:
    `UriComponentsBuilder.fromUriString(uriTemplate).b uild();`
    This essentially fails to properly break out the parameter the regex - instead of seeing one single parameter, it seems to:
    Which is incorrect for one, but also there is no `&` character to delimit two parameters, so it could fail at the very least.
    The `=` character is something that should be allowed, but should be escaped - my understanding is that the escaping should happen inside the RestTemplate, but escaping the `=` before passing in the URI to the RestTemplate didn't work either (the template escapes the entire URI again - which results in an invalid URI).
    Is there something I'm missing on this, or should I open an issue to fix the regex in the UriComponentsBuilder so that it correctly identifies and parses out the parameters of this kind of URIs?
    Thank you.
    Last edited by eugenparaschiv; Sep 12th, 2012, 06:05 PM.

  • #2
    In case anyone else runs into this, this is the JIRA (already answered):