|
7 | 7 | * "License"); you may not use this file except in compliance |
8 | 8 | * with the License. You may obtain a copy of the License at |
9 | 9 | * |
10 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
11 | 11 | * |
12 | 12 | * Unless required by applicable law or agreed to in writing, |
13 | 13 | * software distributed under the License is distributed on an |
|
18 | 18 | */ |
19 | 19 | package org.jooby.internal; |
20 | 20 |
|
21 | | -import static java.util.Objects.requireNonNull; |
22 | | - |
23 | | -import java.nio.charset.Charset; |
24 | | -import java.text.MessageFormat; |
25 | | -import java.util.ArrayList; |
26 | | -import java.util.HashMap; |
27 | | -import java.util.Iterator; |
28 | | -import java.util.LinkedList; |
29 | | -import java.util.List; |
30 | | -import java.util.Locale; |
31 | | -import java.util.Map; |
32 | | -import java.util.Optional; |
33 | | -import java.util.Set; |
34 | | -import java.util.concurrent.Executor; |
35 | | -import java.util.function.Function; |
36 | | -import java.util.stream.Collectors; |
37 | | - |
38 | | -import javax.inject.Inject; |
39 | | -import javax.inject.Named; |
40 | | -import javax.inject.Provider; |
41 | | -import javax.inject.Singleton; |
42 | | - |
43 | | -import org.jooby.Deferred; |
44 | | -import org.jooby.Err; |
45 | | -import org.jooby.Err.Handler; |
46 | | -import org.jooby.MediaType; |
47 | | -import org.jooby.Renderer; |
48 | | -import org.jooby.Request; |
49 | | -import org.jooby.Response; |
50 | | -import org.jooby.Route; |
51 | | -import org.jooby.Session; |
52 | | -import org.jooby.Sse; |
53 | | -import org.jooby.Status; |
54 | | -import org.jooby.WebSocket; |
55 | | -import org.jooby.WebSocket.Definition; |
56 | | -import org.jooby.internal.parser.ParserExecutor; |
57 | | -import org.jooby.spi.HttpHandler; |
58 | | -import org.jooby.spi.NativeRequest; |
59 | | -import org.jooby.spi.NativeResponse; |
60 | | -import org.jooby.spi.NativeWebSocket; |
61 | | -import org.slf4j.Logger; |
62 | | -import org.slf4j.LoggerFactory; |
63 | | - |
64 | 21 | import com.google.common.base.Strings; |
65 | 22 | import com.google.common.base.Throwables; |
66 | 23 | import com.google.common.cache.CacheBuilder; |
|
72 | 29 | import com.google.inject.Key; |
73 | 30 | import com.google.inject.name.Names; |
74 | 31 | import com.typesafe.config.Config; |
75 | | - |
76 | 32 | import javaslang.control.Try; |
| 33 | +import org.jooby.*; |
| 34 | +import org.jooby.Err.Handler; |
| 35 | +import org.jooby.WebSocket.Definition; |
| 36 | +import org.jooby.internal.parser.ParserExecutor; |
| 37 | +import org.jooby.spi.HttpHandler; |
| 38 | +import org.jooby.spi.NativeRequest; |
| 39 | +import org.jooby.spi.NativeResponse; |
| 40 | +import org.jooby.spi.NativeWebSocket; |
| 41 | +import org.slf4j.Logger; |
| 42 | +import org.slf4j.LoggerFactory; |
| 43 | + |
| 44 | +import javax.inject.Inject; |
| 45 | +import javax.inject.Named; |
| 46 | +import javax.inject.Provider; |
| 47 | +import javax.inject.Singleton; |
| 48 | +import java.nio.charset.Charset; |
| 49 | +import java.text.MessageFormat; |
| 50 | +import java.util.*; |
| 51 | +import java.util.concurrent.Executor; |
| 52 | +import java.util.function.Function; |
| 53 | +import java.util.stream.Collectors; |
| 54 | + |
| 55 | +import static java.util.Objects.*; |
77 | 56 |
|
78 | 57 | @Singleton |
79 | 58 | public class HttpHandlerImpl implements HttpHandler { |
@@ -140,7 +119,9 @@ public boolean equals(final Object obj) { |
140 | 119 |
|
141 | 120 | private static final String BYTE_RANGE = "Range"; |
142 | 121 |
|
143 | | - /** The logging system. */ |
| 122 | + /** |
| 123 | + * The logging system. |
| 124 | + */ |
144 | 125 | private final Logger log = LoggerFactory.getLogger(HttpHandler.class); |
145 | 126 |
|
146 | 127 | private Injector injector; |
@@ -181,7 +162,9 @@ public boolean equals(final Object obj) { |
181 | 162 |
|
182 | 163 | private StatusCodeProvider sc; |
183 | 164 |
|
184 | | - /** Global deferred executor. */ |
| 165 | + /** |
| 166 | + * Global deferred executor. |
| 167 | + */ |
185 | 168 | private Key<Executor> gexec; |
186 | 169 |
|
187 | 170 | @Inject |
@@ -404,8 +387,9 @@ private void handleErr(final RequestImpl req, final ResponseImpl rsp, final Thro |
404 | 387 | next.handle(req, rsp, err); |
405 | 388 | } |
406 | 389 | } catch (Throwable errex) { |
407 | | - log.error("execution of: {}{} resulted in exception\n{}Caused by:", |
408 | | - req.method(), req.path(), Throwables.getStackTraceAsString(errex), ex); |
| 390 | + log.error("error handler resulted in exception: {}{}\nRoute:\n{}\n\nStacktrace:{}\nSource:", |
| 391 | + req.method(), req.path(), req.route().print(6), Throwables.getStackTraceAsString(errex), |
| 392 | + ex); |
409 | 393 | } |
410 | 394 | } |
411 | 395 |
|
|
0 commit comments