Mercurial Hosting > luan
annotate src/goodjava/webserver/handlers/MapHandler.java @ 1572:45e42f403fb3
minor - lucene query parser
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 10 Dec 2020 20:23:45 -0700 |
parents | 27efb1fcbcb5 |
children |
rev | line source |
---|---|
1402
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1347
diff
changeset
|
1 package goodjava.webserver.handlers; |
1137 | 2 |
3 import java.util.Map; | |
1402
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1347
diff
changeset
|
4 import goodjava.webserver.Handler; |
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1347
diff
changeset
|
5 import goodjava.webserver.Request; |
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1347
diff
changeset
|
6 import goodjava.webserver.Response; |
1137 | 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 } |