2

I'm developing an API REST with Spring MVC. The idea to have redirections between controllers. My code looks like:

@Controller
public class CustomController {
    @RequestMapping(value = "/a", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getA(@RequestParam(value="param1", required=true),
        HttpServletRequest request, RedirectAttributes attributes) {
        attributes.addAttribute("param1", param1);
        return "redirect:/b";
    }

    @RequestMapping(value = "/b", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getB(@RequestParam(value="param1", required=true),
        HttpServletRequest request) {
        return param1;
    }
}

The issue is, if param1 has for example "ñ" character, "/a" mapping gets "ñ" but when redirecting to "/b", arrives encoded character (%F1). Anyway, if I call directly "/b" request, gets "ñ".

I've tried https://stackoverflow.com/a/5928162/1722794 without success.

Ideas?

Hugo
  • 179
  • 5
  • 14

0 Answers0