Skip response closing and writing if the response was already written

and committed by the application.
This commit is contained in:
hns 2005-01-28 13:52:44 +00:00
parent 0143f7a9dc
commit 4f074f329a
2 changed files with 13 additions and 0 deletions

View file

@ -462,6 +462,13 @@ public final class ResponseTrans implements Serializable {
* web server. Transforms the string buffer into a char array to minimize size.
*/
public synchronized void close(String cset) throws UnsupportedEncodingException {
// if the response was already written and committed by the application
// there's no point in closing the response buffer
HttpServletResponse res = reqtrans.getServletResponse();
if (res != null && res.isCommitted()) {
return;
}
// only use default charset if not explicitly set for this response.
if (charset == null) {
charset = cset;

View file

@ -253,6 +253,12 @@ public abstract class AbstractServletClient extends HttpServlet {
ResponseTrans restrans = getApplication().execute(reqtrans);
// if the response was already written and committed by the application
// we can skip this part and return
if (response.isCommitted()) {
return;
}
// set cookies
if (restrans.countCookies() > 0) {
CookieTrans[] resCookies = restrans.getCookies();