Mercurial Hosting > luan
annotate src/goodjava/webserver/handlers/MapHandler.java @ 2014:1cdc12cdcfa2
make logging more accessible
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 25 Sep 2025 23:41:41 -0600 |
| 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 } |
