All Downloads are FREE. Search and download functionalities are using the official Maven repository.

koncept.http.server.context.HttpContextImpl Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package koncept.http.server.context;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

import com.sun.net.httpserver.Authenticator;
import com.sun.net.httpserver.Filter;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;

public class HttpContextImpl extends HttpContext {

	private final T server;
	private final String path;
	private final Map attributes;
	private final List filters;
	
	private HttpHandler handler;
	private Authenticator authenticator;
	
	public HttpContextImpl(T server, String path) {
		this.server = server;
		this.path = path;
		attributes = new ConcurrentHashMap();
		filters = new CopyOnWriteArrayList<>();
	}
	
	
	@Override
	public HttpHandler getHandler() {
		return handler;
	}

	@Override
	public void setHandler(HttpHandler handler) {
		this.handler = handler;
	}

	@Override
	public String getPath() {
		return path;
	}

	@Override
	public T getServer() {
		return server;
	}

	@Override
	public Map getAttributes() {
		return attributes;
	}

	@Override
	public List getFilters() {
		return filters;
	}

	@Override
	public Authenticator setAuthenticator(Authenticator auth) {
		Authenticator previous = authenticator;
		authenticator = auth;
		return previous;
	}

	@Override
	public Authenticator getAuthenticator() {
		return authenticator;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy