Announcement Announcement Module
Collapse
No announcement yet.
UriTemplate expand method, tries to replace URL parameters containing {} characters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • UriTemplate expand method, tries to replace URL parameters containing {} characters

    Hi there,
    I'm using spring-android 1.0.0.M4 and noticed this behaviour.

    Let's say I want to make a getForObject pointing to following URL:

    protocol://example.com/databases/mydatabse/collections/mycollection?q={"field1":"value1", "field2":"value2"}&apikey=8r2e34gd6d3

    where q it's a json notated query, like mongolab API.

    Well, in this scenario, UriTemplate tries to expand variable "field1":"value1", "field2":"value2" ... which in this case is not a variable, but a URL parameter value.

    Is this an expected behaviour?
    do you plan to support this kind of URL parameters?

    for now, I've made a simple workaround for this, but I'm curious about this kind of URL parameters support.

    thanks!

  • #2
    In this case, this is the expected behavior, because as you noted Rest Template is designed to replace the {param} notation in the url. The easiest workaround for this is to create a String with your JSON data and use that to populate the q={query} part of the url. I could see the benefit of changing the notation used for parameters, since it obviously collides with JSON notation, but that would also break a lot of existing code out there.

    Comment


    • #3
      mnogo zavano, dobre che nai-nakraq se registrirah, che mnogo se izmachih

      Comment

      Working...
      X