From 4beebc65d52b46c6ec62d3c11d243598e72ca46c Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 12 Oct 2009 22:33:19 +0200 Subject: [PATCH] Always close the output stream after a request has completed. --- src/dolda/jsvc/RequestThread.java | 5 +++++ src/dolda/jsvc/test/TestResponder.java | 20 +++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/dolda/jsvc/RequestThread.java b/src/dolda/jsvc/RequestThread.java index c6b9373..7940748 100644 --- a/src/dolda/jsvc/RequestThread.java +++ b/src/dolda/jsvc/RequestThread.java @@ -12,6 +12,11 @@ public class RequestThread extends Thread { public void run() { resp.respond(req); + try { + req.output().close(); + } catch(java.io.IOException e) { + throw(new RuntimeException(e)); + } } public static Request request() { diff --git a/src/dolda/jsvc/test/TestResponder.java b/src/dolda/jsvc/test/TestResponder.java index fb83ecb..1bf4f58 100644 --- a/src/dolda/jsvc/test/TestResponder.java +++ b/src/dolda/jsvc/test/TestResponder.java @@ -12,16 +12,14 @@ public class TestResponder implements Responder { } catch(UnsupportedEncodingException e) { throw(new Error(e)); } - try { - out.println(""); - out.println("Barda"); - out.println(""); - out.println("

Barda

"); - out.println("Bardslen."); - out.println(""); - out.println(""); - } finally { - out.close(); - } + + out.println(""); + out.println("Barda"); + out.println(""); + out.println("

Barda

"); + out.println("Bardslen."); + out.println(""); + out.println(""); + out.flush(); } } -- 2.11.0