From c5364ae271ec11fea2e3d1225846f51ee5d5bc30 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Tue, 13 Oct 2009 00:55:38 +0200 Subject: [PATCH] Actually set the HTTP status code... --- src/dolda/jsvc/j2ee/J2eeRequest.java | 1 + src/dolda/jsvc/test/Bootstrap.java | 2 +- src/dolda/jsvc/test/TestResponder.java | 3 ++- src/dolda/jsvc/util/ResponseBuffer.java | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dolda/jsvc/j2ee/J2eeRequest.java b/src/dolda/jsvc/j2ee/J2eeRequest.java index 9811591..685eeeb 100644 --- a/src/dolda/jsvc/j2ee/J2eeRequest.java +++ b/src/dolda/jsvc/j2ee/J2eeRequest.java @@ -118,6 +118,7 @@ public class J2eeRequest extends ResponseBuffer { } protected void backflush() { + resp.setStatus(respcode); for(String key : outheaders().keySet()) { boolean first = true; for(String val : outheaders().values(key)) { diff --git a/src/dolda/jsvc/test/Bootstrap.java b/src/dolda/jsvc/test/Bootstrap.java index bb72f30..eb73996 100644 --- a/src/dolda/jsvc/test/Bootstrap.java +++ b/src/dolda/jsvc/test/Bootstrap.java @@ -5,6 +5,6 @@ import dolda.jsvc.util.*; public class Bootstrap { public static Responder responder() { - return(new ErrorHandler(new TestResponder())); + return(new ErrorHandler(new Rehandler(new TestResponder()))); } } diff --git a/src/dolda/jsvc/test/TestResponder.java b/src/dolda/jsvc/test/TestResponder.java index 414dfef..3807a2a 100644 --- a/src/dolda/jsvc/test/TestResponder.java +++ b/src/dolda/jsvc/test/TestResponder.java @@ -1,6 +1,7 @@ package dolda.jsvc.test; import dolda.jsvc.*; +import dolda.jsvc.util.*; import java.io.*; public class TestResponder implements Responder { @@ -28,7 +29,7 @@ public class TestResponder implements Responder { out.println(""); if(req.path().equals("bard2")) - throw(new RuntimeException("bard2")); + throw(Restarts.redirectctx("/slen")); out.flush(); } } diff --git a/src/dolda/jsvc/util/ResponseBuffer.java b/src/dolda/jsvc/util/ResponseBuffer.java index 83e91cd..c949464 100644 --- a/src/dolda/jsvc/util/ResponseBuffer.java +++ b/src/dolda/jsvc/util/ResponseBuffer.java @@ -6,8 +6,8 @@ import java.util.*; public abstract class ResponseBuffer implements ResettableRequest { private boolean flushed = false; - private int respcode = -1; - private String resptext = null; + protected int respcode = -1; + protected String resptext = null; private OutputStream out = null, wrapout = null; private MultiMap headers; -- 2.11.0