I have something for ajax login through spring security:
@RequestMapping(value="/entry.html", method=RequestMethod.GET)
public String getEntry(){
return isAuthenticated()? "redirect:/logout.jsp":"entry";
}
@RequestMapping(value="/postLogout.html", method=RequestMethod.GET)
public @ResponseBody String getPostLogout(){
return "{success:true, logout:true, session:false}";
}
The flow is that when receive a call to /entry.html, it will check and choose to
- redirect to
/logout.jsp
=> handled by spring security and then redirect to/postLogout.html
=> response JSON - resolve to view
entry
, which is a jsp contain only a json string
I would like to know if I can use @ResponseBody
in getEntry()
without using an jsp to write just a json value?