How can I get HttpServletRequest when in an HttpSessionListener?

后端 未结 3 745
一整个雨季
一整个雨季 2021-01-18 06:21

How can I access request headers from a SessionListener?

I need to set a timeout on the current session when it is created. The timeout needs to vary based on a head

3条回答
  •  终归单人心
    2021-01-18 07:12

    The HttpSessionListener does not have access to the request because it is invoked when no request has been made—to notify of session destruction.

    So, a Filter or Servlet would be better places to examine the request and specify the session timeout.

提交回复
热议问题