Mercurial Hosting > luan
comparison src/luan/modules/http/LuanHandler.java @ 1383:a3d0d1c2ce89
add NotFound to luanhost
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 01 Aug 2019 16:49:47 -0600 |
parents | 5c3702f60200 |
children | 0dc9837c16be |
comparison
equal
deleted
inserted
replaced
1382:9604579c1c9b | 1383:a3d0d1c2ce89 |
---|---|
86 /* | 86 /* |
87 public Luan getLuan() { | 87 public Luan getLuan() { |
88 return luan; | 88 return luan; |
89 } | 89 } |
90 */ | 90 */ |
91 static final String NOT_FOUND = "luan-not-found"; | |
92 | |
91 @Override public Response handle(Request request) { | 93 @Override public Response handle(Request request) { |
92 if( isDisabled ) | 94 if( isDisabled ) |
93 return null; | 95 return null; |
94 if( request.path.endsWith("/") ) | 96 if( request.path.endsWith("/") ) |
95 return null; | 97 return null; |
96 return handle(request,false); | 98 return handle( request, request.headers.containsKey(NOT_FOUND) ); |
97 } | 99 } |
98 | 100 |
99 Response handle(Request request,boolean notFound) { | 101 private Response handle(Request request,boolean notFound) { |
100 Thread thread = Thread.currentThread(); | 102 Thread thread = Thread.currentThread(); |
101 String oldName = thread.getName(); | 103 String oldName = thread.getName(); |
102 thread.setName(request.headers.get("host")+request.path); | 104 thread.setName(request.headers.get("host")+request.path); |
103 rwLock.readLock().lock(); | 105 rwLock.readLock().lock(); |
104 try { | 106 try { |