aboutsummaryrefslogtreecommitdiff
path: root/samples/src/main/java/fi/iki/elonen/DebugServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'samples/src/main/java/fi/iki/elonen/DebugServer.java')
-rw-r--r--samples/src/main/java/fi/iki/elonen/DebugServer.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/samples/src/main/java/fi/iki/elonen/DebugServer.java b/samples/src/main/java/fi/iki/elonen/DebugServer.java
index b7300c4..bb89181 100644
--- a/samples/src/main/java/fi/iki/elonen/DebugServer.java
+++ b/samples/src/main/java/fi/iki/elonen/DebugServer.java
@@ -2,18 +2,15 @@ package fi.iki.elonen;
import java.util.Map;
-/**
- * @author Paul S. Hawke (paul.hawke@gmail.com)
- * On: 3/8/13 at 9:44 PM
- */
public class DebugServer extends NanoHTTPD {
- /**
- * Constructs an HTTP server on given port.
- */
public DebugServer() {
super(8080);
}
+ public static void main(String[] args) {
+ ServerRunner.run(DebugServer.class);
+ }
+
@Override
public Response serve(String uri, Method method, Map<String, String> header, Map<String, String> parms, Map<String, String> files) {
StringBuilder sb = new StringBuilder();
@@ -21,17 +18,13 @@ public class DebugServer extends NanoHTTPD {
sb.append("<head><title>Debug Server</title></head>");
sb.append("<body>");
sb.append("<h1>Response</h1>");
- sb.append("<p><blockquote><b>URI -</b> ").append(uri).append("<br />");
- sb.append("<b>Method -</b> ").append(method).append("</blockquote></p>");
- sb.append("<h3>Headers</h3><p><blockquote>").append(header).append("</blockquote></p>");
- sb.append("<h3>Parms</h3><p><blockquote>").append(parms).append("</blockquote></p>");
- sb.append("<h3>Files</h3><p><blockquote>").append(files).append("</blockquote></p>");
+ sb.append("<p><blockquote><b>URI -</b> ").append(String.valueOf(uri)).append("<br />");
+ sb.append("<b>Method -</b> ").append(String.valueOf(method)).append("</blockquote></p>");
+ sb.append("<h3>Headers</h3><p><blockquote>").append(String.valueOf(header)).append("</blockquote></p>");
+ sb.append("<h3>Parms</h3><p><blockquote>").append(String.valueOf(parms)).append("</blockquote></p>");
+ sb.append("<h3>Files</h3><p><blockquote>").append(String.valueOf(files)).append("</blockquote></p>");
sb.append("</body>");
sb.append("</html>");
return new Response(sb.toString());
}
-
- public static void main(String[] args) {
- ServerRunner.run(DebugServer.class);
- }
}