Buffers with included pages

R

RogerTBrick

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
 
J

John C. Bollinger

RogerTBrick said:
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
(e-mail address removed)
 
R

RogerTBrick

<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.
 
J

John C. Bollinger

RogerTBrick said:
<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.
 
R

RogerTBrick

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top