|
5 | 5 | */ |
6 | 6 | package io.jooby.internal.netty; |
7 | 7 |
|
| 8 | +import static io.jooby.internal.netty.NettyHeadersFactory.HEADERS; |
8 | 9 | import static io.netty.buffer.Unpooled.wrappedBuffer; |
9 | 10 | import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH; |
10 | 11 | import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE; |
|
31 | 32 | import java.nio.charset.Charset; |
32 | 33 | import java.security.cert.Certificate; |
33 | 34 | import java.util.ArrayList; |
34 | | -import java.util.Arrays; |
35 | 35 | import java.util.Collection; |
36 | 36 | import java.util.Collections; |
37 | 37 | import java.util.HashMap; |
|
75 | 75 | import io.netty.util.IllegalReferenceCountException; |
76 | 76 |
|
77 | 77 | public class NettyContext implements DefaultContext, ChannelFutureListener { |
78 | | - public static HttpHeadersFactory HEADERS = HeadersMultiMap.httpHeadersFactory(); |
79 | 78 | private static final HttpHeaders NO_TRAILING = EmptyHttpHeaders.INSTANCE; |
80 | 79 | private static final String STREAM_ID = "x-http2-stream-id"; |
81 | 80 |
|
82 | 81 | private String streamId; |
83 | | - HttpHeaders setHeaders = HEADERS.newHeaders(); |
| 82 | + HeadersMultiMap setHeaders = HEADERS.newHeaders(); |
84 | 83 | private int bufferSize; |
85 | 84 | InterfaceHttpPostRequestDecoder decoder; |
86 | 85 | DefaultHttpDataFactory httpDataFactory; |
@@ -286,7 +285,7 @@ public List<Certificate> getClientCertificates() { |
286 | 285 | SslHandler sslHandler = (SslHandler) ctx.channel().pipeline().get("ssl"); |
287 | 286 | if (sslHandler != null) { |
288 | 287 | try { |
289 | | - return Arrays.asList(sslHandler.engine().getSession().getPeerCertificates()); |
| 288 | + return List.of(sslHandler.engine().getSession().getPeerCertificates()); |
290 | 289 | } catch (SSLPeerUnverifiedException x) { |
291 | 290 | throw SneakyThrows.propagate(x); |
292 | 291 | } |
@@ -420,13 +419,11 @@ public Context upgrade(@NonNull ServerSentEmitter.Handler handler) { |
420 | 419 | responseStarted = true; |
421 | 420 | ctx.writeAndFlush(new DefaultHttpResponse(HTTP_1_1, status, setHeaders)); |
422 | 421 |
|
423 | | - // ctx.executor().execute(() -> { |
424 | 422 | try { |
425 | 423 | handler.handle(new NettyServerSentEmitter(this)); |
426 | 424 | } catch (Throwable x) { |
427 | 425 | sendError(x); |
428 | 426 | } |
429 | | - // }); |
430 | 427 | return this; |
431 | 428 | } |
432 | 429 |
|
|
0 commit comments