view src/luan/webserver/handlers/MapHandler.java @ 1148:49fb4e83484f

webserver - change headers to lower case
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 04 Feb 2018 17:11:06 -0700
parents c123ee15f99b
children
line wrap: on
line source

package luan.webserver.handlers;

import java.util.Map;
import luan.webserver.Handler;
import luan.webserver.Request;
import luan.webserver.Response;


public final class MapHandler implements Handler {
	private final Map<String,Handler> map;

	public MapHandler(Map<String,Handler> map) {
		this.map = map;
	}

	public Response handle(Request request) {
		Handler handler = map.get(request.path);
		return handler==null ? null : handler.handle(request);
	}
}