2

I have a simple rest endpoint like this:

@RequestMapping(method = RequestMethod.GET, value = "/currencyCode")
public ResponseEntity<String> dummyEndpoint(@RequestParam("currencyCode") String currencyCode) {
    return new ResponseEntity<>(currencyCode, HttpStatus.OK);
}

But when I call this with this http://localhost:8080/currencyCode?currencyCode=£ or this http://localhost:8080/currencyCode?currencyCode=€, I get those responses: £ and €. But for Dollar sign($), it works.

What should I do to get correct symbol using org.springframework.web.bind.annotation.RequestParam?

EDIT: I have tried what @f1sh suggested, but I still have same problem.

((SecurityContextHolderAwareRequestWrapper) request).getRequest().getParameterMap().get("currencyCode") returns ⬠still.

EDIT-2: I have 2 Connectors in my server.xml. They are like this:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" URIEncoding="UTF-8"/>

and

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>

I am using apache-tomcat-7.0.67 by the way.

Thanks...

Community
  • 1
  • 1
GokcenG
  • 2,771
  • 2
  • 25
  • 40
  • @f1sh, I have updated the question. Thanks though. – GokcenG Jun 20 '16 at 17:38
  • How did you make these requests? These symbols must be URL-encoded before transmission and if a correctly-implemented client made the request, it should also have sent the correct content-encoding header – billc.cn Jun 20 '16 at 17:49
  • We're talking about this link http://stackoverflow.com/questions/5445990/get-parameter-encoding right? Where this answer http://stackoverflow.com/a/5501932/1743880 is recommending to set the URI encoding? – Tunaki Jun 20 '16 at 17:49
  • Yes @Tunaki, and I am trying to say that **it doesn't work for me**. If you have any other solution, I'll be glad to hear. – GokcenG Jun 20 '16 at 19:01
  • @billc.cn, I used browser and this request is going to be made by a 3rd party library. We were using Thrift before and it was working with those symbols, hence encoding beforehand doesn't seem to be an option. Thanks. – GokcenG Jun 20 '16 at 19:04

0 Answers0