From: Fredrik Tolf Date: Mon, 12 Oct 2009 17:12:21 +0000 (+0200) Subject: Added a test responder. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=00013ab771bb86a62e6f2fc1f4304755d96c75c1;p=jsvc.git Added a test responder. --- diff --git a/build.xml b/build.xml index 43314b9..309c9b3 100644 --- a/build.xml +++ b/build.xml @@ -12,19 +12,25 @@ - + + - + - + - + + + + + + diff --git a/etc/test.jsvc.properties b/etc/test.jsvc.properties new file mode 100644 index 0000000..2a50054 --- /dev/null +++ b/etc/test.jsvc.properties @@ -0,0 +1,2 @@ +jsvc.j2ee.appname = JSvc Test War +jsvc.bootstrap = dolda.jsvc.test.Bootstrap diff --git a/src/dolda/jsvc/test/Bootstrap.java b/src/dolda/jsvc/test/Bootstrap.java new file mode 100644 index 0000000..49abdd2 --- /dev/null +++ b/src/dolda/jsvc/test/Bootstrap.java @@ -0,0 +1,9 @@ +package dolda.jsvc.test; + +import dolda.jsvc.*; + +public class Bootstrap { + public static Responder responder() { + return(new TestResponder()); + } +} diff --git a/src/dolda/jsvc/test/TestResponder.java b/src/dolda/jsvc/test/TestResponder.java new file mode 100644 index 0000000..fb83ecb --- /dev/null +++ b/src/dolda/jsvc/test/TestResponder.java @@ -0,0 +1,27 @@ +package dolda.jsvc.test; + +import dolda.jsvc.*; +import java.io.*; + +public class TestResponder implements Responder { + public void respond(Request req) { + req.outheaders().put("Content-Type", "text/html; charset=utf-8"); + PrintWriter out; + try { + out = new PrintWriter(new OutputStreamWriter(req.output(), "UTF-8")); + } 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(); + } + } +}