annotate src/goodjava/webserver/handlers/ListHandler.java @ 1531:fa39e3c356ae

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 02 Aug 2020 16:44:38 -0600
parents 27efb1fcbcb5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
1402
27efb1fcbcb5 move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents: 1347
diff changeset
3 import goodjava.webserver.Handler;
27efb1fcbcb5 move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents: 1347
diff changeset
4 import goodjava.webserver.Request;
27efb1fcbcb5 move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents: 1347
diff changeset
5 import goodjava.webserver.Response;
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 public final class ListHandler implements Handler {
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 private final Handler[] handlers;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 public ListHandler(Handler... handlers) {
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 this.handlers = handlers;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 }
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 public Response handle(Request request) {
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 for( Handler handler : handlers ) {
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 Response response = handler.handle(request);
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 if( response != null )
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 return response;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 }
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 return null;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 }
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 }