<target name="build-env">
<mkdir dir="build" />
- <mkdir dir="build/classes" />
+ <mkdir dir="build/bin" />
+ <mkdir dir="build/test-bin" />
</target>
<target name="jsvc" depends="build-env">
- <javac srcdir="src" destdir="build/classes" debug="on">
+ <javac srcdir="src" destdir="build/bin" debug="on">
<!-- <classpath refid="classpath" /> -->
<compilerarg value="-Xlint:unchecked" />
</javac>
- <copy todir="build/classes/dolda/jsvc/j2ee" file="etc/web.xml.template" />
+ <copy todir="build/bin/dolda/jsvc/j2ee" file="etc/web.xml.template" />
</target>
<target name="jsvc-jar" depends="build-env, jsvc">
- <jar destfile="build/jsvc.jar" basedir="build/classes" />
+ <jar destfile="build/jsvc.jar" basedir="build/bin" />
+ </target>
+
+ <target name="test-jar" depends="build-env, jsvc-jar">
+ <copy tofile="build/test-bin/jsvc.properties" file="etc/test.jsvc.properties" />
+ <jar destfile="build/jsvc-test.jar" basedir="build/test-bin" />
</target>
<target name="clean">
--- /dev/null
+package dolda.jsvc.test;
+
+import dolda.jsvc.*;
+
+public class Bootstrap {
+ public static Responder responder() {
+ return(new TestResponder());
+ }
+}
--- /dev/null
+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("<html>");
+ out.println("<head><title>Barda</title></head>");
+ out.println("<body>");
+ out.println("<h1>Barda</h1>");
+ out.println("Bardslen.");
+ out.println("</body>");
+ out.println("</html>");
+ } finally {
+ out.close();
+ }
+ }
+}