Add support for 'http-reponse-headers' attribute to add custom response headers

This commit is contained in:
Mike Primm 2011-08-30 10:33:41 +08:00 committed by mikeprimm
parent d1ff472bda
commit f371cff011
4 changed files with 33 additions and 0 deletions

View file

@ -10,8 +10,10 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.logging.Logger;
@ -34,6 +36,7 @@ public class HttpServer extends Thread {
private Object lock = new Object();
private HashSet<HttpServerConnection> active_connections = new HashSet<HttpServerConnection>();
private HashSet<HttpServerConnection> keepalive_connections = new HashSet<HttpServerConnection>();
private static Map<String, String> headers = new HashMap<String,String>();
public HttpServer(InetAddress bindAddress, int port, boolean check_banned_ips, int max_sessions) {
this.bindAddress = bindAddress;
@ -189,4 +192,10 @@ public class HttpServer extends Thread {
}
return false;
}
public static Map<String,String> getCustomHeaders() {
return headers;
}
public static void setCustomHeaders(Map<String,String> hdrs) {
headers = hdrs;
}
}