mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Fixed httpserver thereby also more optimized.
This commit is contained in:
parent
42d07d6ca2
commit
791341f210
@ -7,7 +7,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class HttpResponse {
|
public class HttpResponse {
|
||||||
private HttpServerConnection connection;
|
private HttpServerConnection connection;
|
||||||
public String version = "1.0";
|
public String version = "1.1";
|
||||||
public int statusCode = 200;
|
public int statusCode = 200;
|
||||||
public String statusMessage = "OK";
|
public String statusMessage = "OK";
|
||||||
public Map<String, String> fields = new HashMap<String, String>();
|
public Map<String, String> fields = new HashMap<String, String>();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dynmap.web;
|
package org.dynmap.web;
|
||||||
|
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -116,9 +117,9 @@ public class HttpServerConnection extends Thread {
|
|||||||
try {
|
try {
|
||||||
socket.setSoTimeout(5000);
|
socket.setSoTimeout(5000);
|
||||||
InputStream in = socket.getInputStream();
|
InputStream in = socket.getInputStream();
|
||||||
OutputStream out = socket.getOutputStream();
|
BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream(), 40960);
|
||||||
|
|
||||||
printOut = new PrintStream(out);
|
printOut = new PrintStream(out, false);
|
||||||
while (true) {
|
while (true) {
|
||||||
HttpRequest request = new HttpRequest();
|
HttpRequest request = new HttpRequest();
|
||||||
|
|
||||||
|
@ -5,12 +5,14 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.dynmap.web.HttpHandler;
|
import org.dynmap.web.HttpHandler;
|
||||||
import org.dynmap.web.HttpRequest;
|
import org.dynmap.web.HttpRequest;
|
||||||
import org.dynmap.web.HttpResponse;
|
import org.dynmap.web.HttpResponse;
|
||||||
|
|
||||||
public abstract class FileHandler implements HttpHandler {
|
public abstract class FileHandler implements HttpHandler {
|
||||||
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
private byte[] readBuffer = new byte[40960];
|
private byte[] readBuffer = new byte[40960];
|
||||||
|
|
||||||
private static Map<String, String> mimes = new HashMap<String, String>();
|
private static Map<String, String> mimes = new HashMap<String, String>();
|
||||||
@ -73,7 +75,6 @@ public abstract class FileHandler implements HttpHandler {
|
|||||||
String mimeType = getMimeTypeFromExtension(extension);
|
String mimeType = getMimeTypeFromExtension(extension);
|
||||||
|
|
||||||
response.fields.put("Content-Type", mimeType);
|
response.fields.put("Content-Type", mimeType);
|
||||||
response.fields.put("Connection", "close");
|
|
||||||
OutputStream out = response.getBody();
|
OutputStream out = response.getBody();
|
||||||
try {
|
try {
|
||||||
int readBytes;
|
int readBytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user