Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-726

Prevent ServletResponse.setCharacterEncoding in SlingHttpServletResponseImpl

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Engine 2.0.2
    • Fix Version/s: Engine 2.0.4
    • Component/s: Engine
    • Labels:
      None

      Description

      The Servlet API 2.4 specifies that calls to the ServletResponse.setCharacterEncoding() method should be ignored if the response has already been committed or if the getWriter() method has already been called. Likewise the character encoding being specified through ServletResponse.setContentType() should be ignored if the getWriter() method has already been called (setContentType should be ignored if the response has already been committed).

      Unfortunately BEA WebLogic 10.3 seems to no ignore this call and instead chooses to act upon it. It looks like WebLogic internally recodes, what has already been written, and resets it into the output buffer, but does not seem to reset the buffer offset before doing this. This causes all kind of garbage of previous requests (since buffers seem to be reused) to be added to the output ....

      Sling should workaround this issue by overwriting the setCharacterEncoding and setContentType methods to prevent the character encoding from being changed after getWriter() has been called.

      The reason, why Sling may run into problems is, that the DefaultSlingScript used by the scripting/core module to adapt scripts to the Servlet interface automatically sets the character encoding before calling the actual script. This may cause responses handled by Sling to become garbled.

        Attachments

          Activity

            People

            • Assignee:
              fmeschbe Felix Meschberger
              Reporter:
              fmeschbe Felix Meschberger
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: