Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-167

Struts is customly coding URL encoding in <bean:include> tag where standard API request.encodeURL() in servlet provide more vender specific solution.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 Beta 1
    • Fix Version/s: 1.0.0
    • Component/s: Tag Libraries
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • Bugzilla Id:
      1644

      Description

      Struts is creating itself vender specific issues by this bug: it hard codes
      URL encoding of session id rather than using the servlet standard API of
      response.encodeURL(), therefore causing all the issues with venders not
      complient to j2ee standard in URL encoding.

      Here is the piece of origial code in
      org.apache.struts.taglib.bean.IncludeTag.hyperlink() that is causing problems:

      ...
      if (includeSession) {
      String sessionId = null;
      HttpServletRequest request =
      (HttpServletRequest) pageContext.getRequest();
      HttpSession session = request.getSession();
      try

      { sessionId = session.getId(); }

      catch (Throwable t)

      { sessionId = null; }

      if (sessionId != null)

      { int question = href.indexOf('?'); if (question < 0) href += ";jsessionid=" + sessionId; else href = href.substring(0, question) + ";jsessionid=" + sessionId + href.substring(question); }

      }
      ...

      This section of code is basically doing the same thing as what
      HttpServletResponse.encodeURL() does in servlet spec, provided that the servlet
      implementation is j2ee compliant. However, many venders are not j2ee compliant
      yet, and they provide their own versions of HttpServletResponse.encodeURL().
      This is why struts is causing problems in Weblogic 5.1. If it simply uses

      if (includeSession)

      { href = ( (HttpServletResponse)(pageContext.getResponse ()) ).encodeURL(href); }

      then you will save yourselves a lot of trouble for vender issues and j2ee
      compliance followup.

      Hope this gets into the next release soon.

      Laurie

        Attachments

          Activity

            People

            • Assignee:
              craigmcc Craig R. McClanahan
              Reporter:
              xiaxin@yahoo.com Xin Xia
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: