greetings all
I have a post method in a controller, which redirects to a new page
I a way such like:
@RequestMapping(method = RequestMethod.POST)
public String post(HttpServletRequest request) {
return "redirect:http://www.x.appName.com/myPage";
}
suppose that the user already has a session before the redirection
and I want to encode the new url before redirection to maintain the user session
how to do so ?
You can pass the
HttpServletResponseas parameter, and use theencodeRedirectURL(..)method:But first make sure spring does not do this for you automatically.