2018-08-17

java tomcat session path



Case deploy to tomcat/webapps/projectA

but access to page by projectA.domain.com/

mean i have tomcat/webapps/projectA/gg.jsp

then deploy to server access by projectA.domain.com/gg.jsp

and facing session path issue.


Solutions refer to:
https://stackoverflow.com/questions/12755499/how-to-change-jsessionid-cookie-path-to-server-root-in-spring-app-on-jetty

<session-config>
    <session-timeout>15</session-timeout>
    <cookie-config>
        <name>JSESSIONID</name>
        <path>/</path>
        <http-only>false</http-only>
        <secure>false</secure>
    </cookie-config>
</session-config>








Reference URL:
https://www.mkyong.com/servlet/how-to-configure-the-session-timeout-in-servlet/

1) Timeout in the deployment descriptor (web.xml)
– Specified the timeout value in “minute” , enclose with “session-config” element.
<web-app ...> <session-config> <session-timeout>20</session-timeout> </session-config></web-app>CopyThe above setting is apply for the entire web application, and session will be kill by container if client doesn’t make any request after 20 minutes.




Reference URL:
https://stackoverflow.com/questions/40753753/cookies-with-path-path-and-jsessionid













No comments:

Post a Comment