Initial http-server work.
This commit is contained in:
parent
711341ec47
commit
bf0edea7e2
4 changed files with 163 additions and 40 deletions
27
src/main/java/org/dynmap/web/HttpResponse.java
Normal file
27
src/main/java/org/dynmap/web/HttpResponse.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package org.dynmap.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpResponse {
|
||||
public int statusCode = 200;
|
||||
public String statusMessage = "OK";
|
||||
public Map<String, String> fields = new HashMap<String, String>();
|
||||
|
||||
private OutputStream body;
|
||||
public OutputStream getBody() throws IOException {
|
||||
if (body != null) {
|
||||
WebServerRequest.writeResponseHeader(body, this);
|
||||
OutputStream b = body;
|
||||
body = null;
|
||||
return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public HttpResponse(OutputStream body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue