public static class TestHttpServer extends HttpSession {
public void execute() throws Pausable, Exception {
try {
while (true) {
HttpRequest req = new HttpRequest();
HttpResponse resp = new HttpResponse();
// Fill up the request object. This pauses until the entire request has
// been read in, including all chunks.
super.readRequest(req);
// System.out.println(req);
if (req.method.equals("GET")) {
resp.setContentType("text");
PrintWriter pw = new PrintWriter(resp.getOutputStream());
pw.append(req.uriPath).append(req.getQueryComponents().toString());
pw.flush();
sendResponse(resp);
} else if (req.method.equals("POST")) {
resp.setContentType("text");
PrintWriter pw = new PrintWriter(resp.getOutputStream());
String s = req.extractRange(req.contentOffset, req.contentOffset + req.contentLength);
pw.append(s);
pw.flush();
sendResponse(resp);
} else {