You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
url param containing ? is not getting encoded by Rest Template [SPR-14101] #18673
in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement
Hi I have a get request url which I am trying to send via RestTemplate, like :
url?param1=a1¶m2=a2 and so no
one of the params in turn comprises a "?" (question mark)
So, I get 403 forbidden response as Spring's Rest Template does not encode it by substituting with %3F while all other values in the same param like space(%20) and equals to(%3D) are getting substituted.
It should encode ? present in the param value as well.
If it cannot, what is the other way to resolve that.
"?" is a legal character in the query string as per RFC 3986 so we are not doing anything wrong.
Note however that the RestTemplate provides a hook for customizing URI template handling (the uriTemplateHandler property). The DefaultUriTemplateHandler provides some built-in options and for 4.3 it will also include a strictEncoding property that encodes every reserved character in a URI variable.
in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement
Activity
spring-projects-issues commentedon Apr 1, 2016
Rossen Stoyanchev commented
"?" is a legal character in the query string as per RFC 3986 so we are not doing anything wrong.
Note however that the
RestTemplateprovides a hook for customizing URI template handling (theuriTemplateHandlerproperty). TheDefaultUriTemplateHandlerprovides some built-in options and for 4.3 it will also include astrictEncodingproperty that encodes every reserved character in a URI variable.