Mercurial Hosting > luan
annotate src/luan/modules/http/NotFound.java @ 1806:3b7a8f1cc887 default tip
update discord
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 09 May 2024 20:39:53 -0600 |
parents | 27efb1fcbcb5 |
children |
rev | line source |
---|---|
1171 | 1 package luan.modules.http; |
377 | 2 |
1402
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1383
diff
changeset
|
3 import goodjava.webserver.Request; |
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1383
diff
changeset
|
4 import goodjava.webserver.Response; |
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1383
diff
changeset
|
5 import goodjava.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 } |