Difference between request.getSession() and request.getSession(true)

后端 未结 7 1733
难免孤独
难免孤独 2021-01-31 08:43

I understand the difference between request.getSession(true) and request.getSession(false). But request.getSession() & request.g

7条回答
  •  一生所求
    2021-01-31 09:02

    They both return the same thing, as noted in the documentation you linked; an HttpSession object.

    You can also look at a concrete implementation (e.g. Tomcat) and see what it's actually doing: Request.java class. In this case, basically they both call:

    Session session = doGetSession(true);
    

提交回复
热议问题