remove jsessionid in url

一个人想着一个人 提交于 2019-12-06 03:45:55

问题


I am facing a problem in jsf web application deployed in jetty web-server. When access application in browser, jsessionID is appended in the url. I want to remove it from there. Thanks in advance.


回答1:


Set the org.mortbay.jetty.servlet.SessionURL parameter to none in either the application web.xml or the context configuration.

See the Jetty jsessionId documentation.




回答2:


You can do that by Setting Session Characteristics. Set the context parameter org.eclipse.jetty.servlet.SessionIdPathParameterName to none to disable url rewriting and prevent the jsession id appended to URL.

In web.xml,

<context-param>
    <param-name>org.eclipse.jetty.servlet.SessionIdPathParameterName</param-name>
    <param-value>none</param-value>
</context-param>

Or if you are using annotation config instead of web.xml,

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
       servletContext.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none");
}

Refer: Jetty's Session Management



来源:https://stackoverflow.com/questions/7820120/remove-jsessionid-in-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!