简体   繁体   中英

Spring Rest service getting encoded request parameter

I am facing an issue where url sent to spring rest service containing parameter "xyz=abc & amp ;emailDate=2014-09-09"

This URL is hit from emails sent to the customer. And when customer hits the URL some browser client on user's mobile is not converting "& amp ;" to &.

Please ignore spaces above. Stackoverflow is converting & amp ; to & if there are no spaces.

When request comes to server we see emailDate as null. Server side code is as below.

@RequestMapping(value="/openEmail", method=RequestMethod.GET)
public @ResponseBody byte[] openEmail(RequestParam(value="token",  required=false) String customerToken, @RequestParam(value="emailDate", required=false) String emailDate, HttpServletRequest request) throws IOException{

Can you please help me overcome this issue.

Please check if you set URIEncoding="UTF-8" in your server.xml ( if its tomcat ). More details here Get Parameter Encoding

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM