我在jetty web server中部署jsf web应用程序时遇到了一个问题。当在浏览器中访问应用程序时,在url中添加jsessionID。我想把它移开。
在应用程序web.xml或上下文配置中将org.mortbay.jetty.servlet.SessionURL
参数设置为none
。
查看Jetty jsessionId文档
可以通过设置会话特征来实现。设置上下文参数"org.eclipse.jetty.servlet.SessionIdPathParameterName
"为"none
",禁止url重写,防止url后添加jsession id。
,
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionIdPathParameterName</param-name>
<param-value>none</param-value>
</context-param>
或者如果你使用的是annotation config而不是web.xml,
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none");
}
参考:Jetty's Session Management