Added helper classes for HTTP.

This commit is contained in:
FrozenCow 2011-02-15 14:19:43 +01:00
parent 060d1092f9
commit e900aca2e0
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package org.dynmap.web;
import java.io.IOException;
public class HttpErrorHandler {
public static void handle(HttpResponse response, int statusCode, String statusMessage) throws IOException {
response.statusCode = statusCode;
response.statusMessage = statusMessage;
response.fields.put("Content-Length", "0");
response.getBody();
}
public static void handleNotFound(HttpResponse response) throws IOException {
handle(response, 404, "Not found");
}
public static void handleMethodNotAllowed(HttpResponse response) throws IOException {
handle(response, 405, "Method not allowed");
}
}

View File

@ -0,0 +1,8 @@
package org.dynmap.web;
public class HttpMethods {
public static final String Get = "GET";
public static final String Post = "POST";
public static final String Put = "PUT";
public static final String Delete = "DELETE";
}