www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew King <mk...@district.vannet.k12.wa.us>
Subject mod_jserv/5057: output stream closed during a re-direct to a servlet
Date Wed, 22 Sep 1999 23:11:28 GMT

>Number:         5057
>Category:       mod_jserv
>Synopsis:       output stream closed during a re-direct to a servlet
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Sep 22 16:20:02 PDT 1999
>Last-Modified:
>Originator:     mking@district.vannet.k12.wa.us
>Organization:
apache
>Release:        Apache 1.3.6 Jserv 1.0
>Environment:
Windows 98
JDK 1.1.8
JSDK 2.0 and 2.1
>Description:
When performing a sendRedirect() from one servlet to another, calling out.flush()
causes the output stream to close.  

I was using the flush command to allow the parent class to write information at
the top of every page produced by the child classes.  This worked fine in normal
(ie GET, POST, etc) operations.  However, when the child class received a 
redirect, the call to flush() closes the output stream after writing.
>How-To-Repeat:
To replicate it, put a call to out.flush() in the middle of either doGet() or
doPost().  Example:

out.println ("Hello");
out.flush();
out.println ("Goodbye");

During normal operations, this will simply write "Hello" to the browser, followed
by "Goodbye" (demonstrating that the flush() did not close the output stream. 

During a redirect, it will write "Hello" and then close the output stream.  
"Goodbye" will never appear.

I can also send a pair of example servlets that show this problem, if you like.
>Fix:
The redirect should wait until a close() is received, or the specific number of 
bytes in setContentLength() are received.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <apbugs@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]




Mime
View raw message