我要重写我之前的问题。
Glassfish在表单登录后重定向到上次访问的资源,我该如何关闭它?
我们的问题是,我们在FF和IE中得到415,因为如果我有一个JSESSION cookie,Glassfish将重定向到我试图访问的最后一个资源,但没有从(x-form-urlencoded)切换内容类型。
伪例(请求是浏览器的XMLHttpRequest):
GET /secure/resouce1 (json) -> Response "you're not logged in."
GET /login.xhtml
POST /j_secure (x-form-urlencoded) -> New location /secure/resource1 (x-form-urlencoded)
GET /secure/resource1 (x-form-urlencoded) <- HTTP ERROR 415 content type not JSON.发布于 2013-06-07 09:24:34
在登录页面中
重置JSESSIONID cookie以防止重定向最后一页
// login_form.jsp
Cookie jsess = new Cookie("JSESSIONID",null);
jsess.setMaxAge(0);
jsess.setPath(pageContext.getServletContext().getContextPath());
response.addCookie(jsess);
https://stackoverflow.com/questions/15947628
复制相似问题