Java 在 Weblogic 中配置会话 cookie
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24562469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Configuring session cookies in Weblogic
提问by Mike
I'm pretty new to Weblogic and I'm currently trying to convert a web application that I've been running using Tomcat on my local machine to work with Weblogic since our production servers are weblogic. I'm having trouble configuring weblogic.xml so that I can access session attributes. Currently my weblogic.xml looks like this...
我是 Weblogic 的新手,我目前正在尝试将我在本地机器上使用 Tomcat 运行的 Web 应用程序转换为与 Weblogic 一起使用,因为我们的生产服务器是 weblogic。我在配置 weblogic.xml 以访问会话属性时遇到问题。目前我的 weblogic.xml 看起来像这样......
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session-descriptor>
<cookie-name>JSESSIONID</cookie-name>
<cookie-domain>localhost</cookie-domain>
<cookie-path>/domain</cookie-path>
<cookie-secure>false</cookie-secure>
<url-rewriting-enabled>false</url-rewriting-enabled>
</session-descriptor>
<jsp-descriptor>
<precompile>false</precompile>
<precompile-continue>true</precompile-continue>
<keepgenerated>false</keepgenerated>
</jsp-descriptor>
<context-root>/domain</context-root>
<library-ref>
<library-name>springLib</library-name>
</library-ref>
</weblogic-web-app>
This does not seem to be working when I run locally. Do I need to include the port number in the cookie-domain (i.e. localhost:7001)? This seems to be the only glitch I haven't been able to resolve. If anyone has any ideas please help. Thanks in advance.
当我在本地运行时,这似乎不起作用。我是否需要在 cookie 域中包含端口号(即 localhost:7001)?这似乎是我唯一无法解决的故障。如果有人有任何想法,请帮助。提前致谢。
采纳答案by Mike
I was able to accomplish what I needed by making the following changes:
通过进行以下更改,我能够完成所需的工作:
<cookie-domain></cookie-domain>
<cookie-path>/</cookie-path>