mirror of https://github.com/webbukkit/dynmap.git
Added helper classes for HTTP.
This commit is contained in:
parent
060d1092f9
commit
e900aca2e0
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -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";
|
||||
}
|
Loading…
Reference in New Issue