当Weblogic重定向到Apache时是否将JSESSIONID添加到URL?

ojsjcaue  于 2022-11-16  发布在  Apache
关注(0)|答案(3)|浏览(113)

我们的应用程序在WebLogic上运行。
在某个时候,WebLogic会重定向到Apache以允许用户访问PDF文件。
这通过以下方式实现:

final String encodedURL = resp.encodeRedirectURL(redirectURL);                
resp.sendRedirect(encodedURL); //ok here because redirection to other  server and not  to itself

问题是WebLogic将JSESSIONID附加到URL,apache无法提供PDF文档。
如何防止WebLogic将JSESSIONID添加到URL?

pgccezyw

pgccezyw1#

关键是在必要时在URL中包含会话ID。如果您认为没有必要包含会话ID,请不要对URL进行编码:

resp.sendRedirect(redirectURL);
ercv8c1e

ercv8c1e2#

问题是,在我们的weblogic.xml中,cookie被禁用:

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<session-descriptor>
    <cookies-enabled>false</cookies-enabled>
</session-descriptor>

whe通过将它们设置为true来解决问题。在此特殊应用程序中,这不是问题:

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<session-descriptor>
    <cookies-enabled>true</cookies-enabled>
</session-descriptor>
83qze16e

83qze16e3#

将其添加到我的基于Facelets的应用程序的web.xml中可以避免JSESSIONID:

<session-config>
    <tracking-mode>COOKIE</tracking-mode>
</session-config>

相关问题