开发者

context destroyed, but ths session is still open

I'm new to jsf and I've read that a session can be destroyed

FacesContext fc = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);      

fc.getExternalContext().getSessionMap().clear();

session.invalidate();

My problem ist开发者_开发百科, after doing that the session is still active, with the following bean :

com.sun.faces.renderkit.ServerSideStateHelper.LogicalViewMap

Do you have an idea?


That's just a new session. To test it yourself, check the value of HttpSession#getId() during the request before and after invalidate. It should be different.


Unrelated to the concrete question, clearing the session map is unnecessary whenever you call invalidate(). The session map will be trashed anyway. Also note that getSession(false) can potentially return null and you'd like to add an extra check to avoid NullPointerException. Or just use getSession(true) instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜