Mercurial Hosting > luan
annotate src/luan/modules/http/NotFound.java @ 1383:a3d0d1c2ce89
add NotFound to luanhost
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 01 Aug 2019 16:49:47 -0600 |
parents | 1d31c1f3ea30 |
children | 27efb1fcbcb5 |
rev | line source |
---|---|
1171 | 1 package luan.modules.http; |
377 | 2 |
1347
643cf1c37723
move webserver to lib and bug fixes
Franklin Schmidt <fschmidt@gmail.com>
parents:
1171
diff
changeset
|
3 import luan.lib.webserver.Request; |
643cf1c37723
move webserver to lib and bug fixes
Franklin Schmidt <fschmidt@gmail.com>
parents:
1171
diff
changeset
|
4 import luan.lib.webserver.Response; |
643cf1c37723
move webserver to lib and bug fixes
Franklin Schmidt <fschmidt@gmail.com>
parents:
1171
diff
changeset
|
5 import luan.lib.webserver.Handler; |
377 | 6 |
7 | |
1160 | 8 public class NotFound implements Handler { |
1383
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
9 private final Handler handler; |
377 | 10 |
1383
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
11 public NotFound(Handler handler) { |
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
12 this.handler = handler; |
377 | 13 } |
14 | |
1160 | 15 @Override public Response handle(Request request) { |
1383
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
16 request.headers.put(LuanHandler.NOT_FOUND,"whatever"); |
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
17 try { |
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
18 return handler.handle(request); |
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
19 } finally { |
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
20 request.headers.remove(LuanHandler.NOT_FOUND); |
a3d0d1c2ce89
add NotFound to luanhost
Franklin Schmidt <fschmidt@gmail.com>
parents:
1358
diff
changeset
|
21 } |
377 | 22 } |
23 | |
24 } |