Reputation: 137
We would like to redirect user after a successful post to secure pages.
@RequestMapping(value="/myapp", method=POST)
public String processForm(Formbean formbean){
// redirect to https ??????
return "redirect:/secure";
}
Is there any easy way to make it without writing full redirection url?
Upvotes: 2
Views: 2988
Reputation: 5188
Not too sure you can do that without specifying the entire url in the redirect string.
Perhaps its best to add a security constraint for that url in your web.xml setting the transport-guarantee to CONFIDENTIAL. If your servlet container is setup correctly then that should be all you need to get it to do the automatic redirect for you.
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure page</web-resource-name>
<url-pattern>/securePage.html</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Upvotes: 0
Reputation: 17761
you can check out RedirectView and the contextRelative parameter in the Spring API Docs:
hope that helped...
Upvotes: 2