Buffers with included pages

Discussion in 'Java' started by RogerTBrick, May 12, 2004.

  1. RogerTBrick

    RogerTBrick Guest

    I have noted a difference between how Tomcat and WebLogic assign
    buffers, and I'm trying to figure out which is correct. I have an
    "outer" page that does not define any buffer, and an "inner" page that
    does, e.g.:
    "outer.jsp"
    <html>
    <body>
    Outer buffer is <%=pageContext.getOut().getBufferSize()%><BR>
    <jsp:include "inner.jsp">
    </body>
    <html>

    "inner.jsp"
    <@ page buffer="64kb" %>
    Inner buffer is <%=pageContext.getOut().getBufferSize()%>

    Tomcat reports 8kb for "outer.jsp" and then 64kb for "inner.jsp".
    WebLogic reports 12kb for both. It's as if Tomcat creates new
    JspWriter for each dynamic include, but WebLogic keeps using the same
    JspWriter.

    Looking as this page
    http://java.sun.com/products/jsp/tags/syntaxref.fm7.html makes me
    think Tomcat is correct, but I am not 100% sure. Any ideas? Am I
    doing something stupid?

    Cheers,

    RtB
    RogerTBrick, May 12, 2004
    #1
    1. Advertising

  2. RogerTBrick wrote:

    > I have noted a difference between how Tomcat and WebLogic assign
    > buffers, and I'm trying to figure out which is correct. I have an
    > "outer" page that does not define any buffer, and an "inner" page that
    > does, e.g.:
    > "outer.jsp"
    > <html>
    > <body>
    > Outer buffer is <%=pageContext.getOut().getBufferSize()%><BR>
    > <jsp:include "inner.jsp">
    > </body>
    > <html>
    >
    > "inner.jsp"
    > <@ page buffer="64kb" %>
    > Inner buffer is <%=pageContext.getOut().getBufferSize()%>
    >
    > Tomcat reports 8kb for "outer.jsp" and then 64kb for "inner.jsp".
    > WebLogic reports 12kb for both. It's as if Tomcat creates new
    > JspWriter for each dynamic include, but WebLogic keeps using the same
    > JspWriter.


    There is not enough information to draw that conclusion about WebLogic.
    It is entirely conceivable that WebLogic is using two different
    JspWriters that have like sized buffers. If that were the case,
    however, then I would find fault with WebLogic for not honoring the
    specified buffer size.

    > Looking as this page
    > http://java.sun.com/products/jsp/tags/syntaxref.fm7.html makes me
    > think Tomcat is correct, but I am not 100% sure. Any ideas? Am I
    > doing something stupid?


    I would refer to the actual JSP specification to determine requirements.
    Sections 2.7, 2.10, 4.4, and 8.3 all appear relevant. I would
    also use "out" in my code rather than "pageContext.getOut()," but it
    shouldn't make a difference.

    Tomcat is fully in compliance with the specs, as far as I can tell, but
    that doesn't necessarilly mean that WebLogic is not. In my opinion,
    Tomcat implements the intended model. (And indeed, Tomcat 4 is the
    reference implementation for Servlet 2.3 and JSP 1.2.) WebLogic's model
    may not be excluded by the spec, however. Section 8.3 in particular
    indicates that "the JSP container buffers data [...] as it is sent from
    the server to the client"; this could be interpreted as scoping the
    applicability of the page directive's buffer attribute to the outermost JSP.

    Overall, although it may be that WebLogic is technically compliant (as
    it should be, given that it is J2EE certified), I think Tomcat's
    approach is better. It's certainly less likely to surprise folks.


    John Bollinger
    John C. Bollinger, May 12, 2004
    #2
    1. Advertising

  3. RogerTBrick

    RogerTBrick Guest

    "John C. Bollinger" <> wrote...
    <snip>
    Thanks John. I will go and read the sections you've mentioned.

    I am fairly sure that WebLogic is only using the one JspWriter. As I
    add more content to "outer.jsp", the available buffer to "inner.jsp"
    reduces by a corresponding amount.

    "outer.jsp"
    <html>
    <body>
    Outer buffer is <%=out.getBufferSize()%><BR>
    Remaining <%=out.getgetRemaining()%><BR>
    <jsp:include "inner.jsp">
    </body>
    <html>

    "inner.jsp"
    <@ page buffer="64kb" %>
    Inner buffer is <%=out.getBufferSize()%>
    Remaining <%=out.getgetRemaining()%><BR>

    Thanks again.

    RtB.
    RogerTBrick, May 13, 2004
    #3
  4. RogerTBrick wrote:
    > "John C. Bollinger" <> wrote...
    > <snip>
    > Thanks John. I will go and read the sections you've mentioned.
    >
    > I am fairly sure that WebLogic is only using the one JspWriter. As I
    > add more content to "outer.jsp", the available buffer to "inner.jsp"
    > reduces by a corresponding amount.


    That seems pretty indicative, I agree. Moreover, if WebLogic is only
    using one writer then that certainly explains why it is not honoring the
    page buffer directive of the included page. In the end, though, whether
    or not WebLogic's behavior is technically correct is probably irrelevant
    to you. If your goal is to create a working application for WebLogic
    then you're going to have to live with whatever WebLogic does. Perhaps
    you can configure WebLogic to behave as Tomcat does in this regard, but
    I wouldn't count on it. Evidently it is unwise to depend specifically
    on either behavior for correctness of your program.

    --
    John Bollinger
    John C. Bollinger, May 14, 2004
    #4
  5. RogerTBrick

    RogerTBrick Guest

    "John C. Bollinger" wrote ...
    > Evidently it is unwise to depend specifically
    > on either behavior for correctness of your program.

    Indeed. It is this kind of thing that makes writing cross-platform
    applications such a joy. I don't even want to contemplate what will
    happen when we have to support WebSphere too. And I thought doing
    HTML for Netscape and IE was bad!

    I have an open call with BEA, so I may whinge at them a bit more. :p

    RtB.
    RogerTBrick, May 18, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oleg
    Replies:
    4
    Views:
    6,805
    Ray Andraka
    Apr 6, 2004
  2. ratep2001

    Delay with buffers

    ratep2001, Feb 25, 2005, in forum: VHDL
    Replies:
    3
    Views:
    4,103
    cristian
    Feb 28, 2005
  3. Replies:
    2
    Views:
    488
  4. Tim Greenfield

    WriteFile buffers in memory

    Tim Greenfield, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,085
    Tim Greenfield
    Oct 5, 2004
  5. Mike
    Replies:
    4
    Views:
    5,049
    Kevin McMurtrie
    Aug 3, 2004
Loading...

Share This Page