glassfish
  1. glassfish
  2. GLASSFISH-2553

page directive with buffer="none" is not honored and response.getBufferSize() returns 8192

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 9.1pe
    • Fix Version/s: 9.1pe
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Sun

    • Issuezilla Id:
      2,553

      Description

      JSP page looks as follows:

      <%@page buffer="none" %>
      Page buffer size = <%= response.getBufferSize() %>

      When the JSP is accessed, it shows Page buffer size = 8192.
      This is incorrect and should show 0.

      Cause:
      -------

      CoyoteResponse:
      public CoyoteResponse(boolean chunkingDisabled)

      { outputBuffer = new OutputBuffer(chunkingDisabled); .. }

      OutputBuffer:
      public OutputBuffer(boolean chunkingDisabled)

      { this(DEFAULT_BUFFER_SIZE, chunkingDisabled); }

      public OutputBuffer(int size, boolean chunkingDisabled) {
      bb = new ByteChunk(size);
      if (!chunkingDisabled)

      { bb.setLimit(size); }
      bb.setByteOutputChannel(this);
      }

      The above code creates ByteChunk with 8192 (DEFAULT_BUFFER_SIZE).

      JspFactoryImpl, PageContextImpl and JspWriterImpl do honor buffer="none" and
      invoke response.setBufferSize(0) which in turn calls setBufferSize on
      CoyoteResponse and OutputBuffer

      But OutputBuffer's setBufferSize(0) gets ignored as size=0 and bb.getLimit() is
      8192 in the below code:

      OutputBuffer:
      public void setBufferSize(int size) {
      if (size > bb.getLimit()) { bb.setLimit(size); }

      }

      When the response.getBufferSize() is called, it results in a call to
      OutputBuffer's getBufferSize that returns 8192
      public int getBufferSize()

      { return bb.getLimit(); }

        Activity

        Hide
        kmeduri added a comment -

        CCed Arvind.

        Show
        kmeduri added a comment - CCed Arvind.
        Hide
        jluehe added a comment -

        JSP buffering is different from, and is not required to have any effect on, or
        be the same as, the buffering performed by the underlying ServletResponse.

        JSP.1.7

        Initially, "out" is a new JspWriter object. This object may be different
        from the stream object returned from response.getWriter(), and may be
        considered to be interposed on the latter in order to implement
        buffering [...]

        Table JSP.1-8 ("Page Directive Attributes")

        "buffer":
        Specifies the buffering model for the initial "out" JspWriter to
        handle content output from the page.
        If "none", then there is no buffering and all output is written directly
        through to the ServletResponse PrintWriter.

        Show
        jluehe added a comment - JSP buffering is different from, and is not required to have any effect on, or be the same as, the buffering performed by the underlying ServletResponse. JSP.1.7 Initially, "out" is a new JspWriter object. This object may be different from the stream object returned from response.getWriter(), and may be considered to be interposed on the latter in order to implement buffering [...] Table JSP.1-8 ("Page Directive Attributes") "buffer": Specifies the buffering model for the initial "out" JspWriter to handle content output from the page. If "none", then there is no buffering and all output is written directly through to the ServletResponse PrintWriter.
        Hide
        gfbugbridge added a comment -

        <BT6531987>

        Show
        gfbugbridge added a comment - <BT6531987>

          People

          • Assignee:
            jluehe
            Reporter:
            kmeduri
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: