【问题标题】:JSESSIONID added to URL when Weblogic redirects to Apache?当 Weblogic 重定向到 Apache 时,JSESSIONID 添加到 URL 中?
【发布时间】:2011-11-16 20:46:14
【问题描述】:

我们的应用程序正在 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?

【问题讨论】:

    标签: apache servlets weblogic httpsession jsessionid


    【解决方案1】:

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

    resp.sendRedirect(redirectURL);
    

    【讨论】:

      【解决方案2】:

      问题是,我们的 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>
      

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

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

      【讨论】:

        【解决方案3】:

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

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

        【讨论】:

          猜你喜欢
          • 2017-07-08
          • 2012-10-05
          • 2010-12-15
          • 2011-04-24
          • 1970-01-01
          • 1970-01-01
          • 2018-06-11
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多