summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-01 19:18:42 +0200
committerSimon Rettberg2015-09-01 19:18:42 +0200
commitcc9c9990466dcbc44070bd4474fef29a505866a6 (patch)
treefebc32f3a6724c396fc64f48d8cd46c8db2f603c /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java
parent[*] Clean up pom.xml, add shading to client, clean up .gitignore (diff)
downloadtutor-module-cc9c9990466dcbc44070bd4474fef29a505866a6.tar.gz
tutor-module-cc9c9990466dcbc44070bd4474fef29a505866a6.tar.xz
tutor-module-cc9c9990466dcbc44070bd4474fef29a505866a6.zip
[server] Add WebServer, add XML serialization classes (vmchooser list)
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java
new file mode 100644
index 00000000..02172616
--- /dev/null
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java
@@ -0,0 +1,36 @@
+package org.openslx.bwlp.sat.web;
+
+import fi.iki.elonen.NanoHTTPD;
+
+public class WebServer extends NanoHTTPD {
+
+ public WebServer(int port) {
+ super(port);
+ }
+
+ @Override
+ public Response serve(IHTTPSession session) {
+ String uri = session.getUri();
+
+ if (uri == null || uri.length() == 0) {
+ return internalServerError();
+ }
+
+ // Our special stuff
+ if (uri.startsWith("/vmchooser/list")) {
+ return serveVmChooserList();
+ }
+
+ return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, "text/plain", "Nicht gefunden!");
+ }
+
+ private Response serveVmChooserList() {
+ return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, "text/plain", "BLA");
+ }
+
+ private Response internalServerError() {
+ return new NanoHTTPD.Response(NanoHTTPD.Response.Status.INTERNAL_ERROR, "text/plain",
+ "Internal Server Error");
+ }
+
+}