comparison src/goodjava/webserver/handlers/MapHandler.java @ 1402:27efb1fcbcb5

move luan.lib to goodjava
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 17 Sep 2019 01:35:01 -0400
parents src/luan/lib/webserver/handlers/MapHandler.java@643cf1c37723
children
comparison
equal deleted inserted replaced
1401:ef1620aa99cb 1402:27efb1fcbcb5
1 package goodjava.webserver.handlers;
2
3 import java.util.Map;
4 import goodjava.webserver.Handler;
5 import goodjava.webserver.Request;
6 import goodjava.webserver.Response;
7
8
9 public final class MapHandler implements Handler {
10 private final Map<String,Handler> map;
11
12 public MapHandler(Map<String,Handler> map) {
13 this.map = map;
14 }
15
16 public Response handle(Request request) {
17 Handler handler = map.get(request.path);
18 return handler==null ? null : handler.handle(request);
19 }
20 }