|
15 | 15 | */ |
16 | 16 | packageorg.asynchttpclient.reactivestreams; |
17 | 17 |
|
| 18 | +importstaticio.netty.handler.codec.http.HttpHeaders.Names.*; |
| 19 | +importstaticio.netty.handler.codec.http.HttpMethod.GET; |
| 20 | +importstaticio.netty.handler.codec.http.HttpResponseStatus.*; |
| 21 | +importstaticio.netty.handler.codec.http.HttpVersion.HTTP_1_1; |
18 | 22 | importio.netty.buffer.ByteBuf; |
19 | 23 | importio.netty.buffer.Unpooled; |
20 | 24 | importio.netty.channel.ChannelFuture; |
|
36 | 40 | importio.netty.handler.ssl.SslHandler; |
37 | 41 | importio.netty.handler.stream.ChunkedFile; |
38 | 42 | importio.netty.util.CharsetUtil; |
| 43 | + |
39 | 44 | importjava.io.File; |
40 | 45 | importjava.io.FileNotFoundException; |
41 | 46 | importjava.io.RandomAccessFile; |
|
48 | 53 | importjava.util.Locale; |
49 | 54 | importjava.util.TimeZone; |
50 | 55 | importjava.util.regex.Pattern; |
| 56 | + |
51 | 57 | importjavax.activation.MimetypesFileTypeMap; |
52 | | -importorg.asynchttpclient.test.TestUtils; |
53 | 58 |
|
54 | | -importstaticio.netty.handler.codec.http.HttpHeaders.Names.*; |
55 | | -importstaticio.netty.handler.codec.http.HttpMethod.GET; |
56 | | -importstaticio.netty.handler.codec.http.HttpResponseStatus.*; |
57 | | -importstaticio.netty.handler.codec.http.HttpVersion.HTTP_1_1; |
| 59 | +importorg.asynchttpclient.test.TestUtils; |
| 60 | +importorg.slf4j.Logger; |
| 61 | +importorg.slf4j.LoggerFactory; |
58 | 62 |
|
59 | 63 |
|
60 | 64 | /** |
|
105 | 109 | */ |
106 | 110 | publicclassHttpStaticFileServerHandlerextendsSimpleChannelInboundHandler<FullHttpRequest> { |
107 | 111 |
|
| 112 | +privatestaticfinalLoggerLOGGER =LoggerFactory.getLogger(HttpStaticFileServerHandler.class); |
108 | 113 | publicstaticfinalStringHTTP_DATE_FORMAT ="EEE, dd MMM yyyy HH:mm:ss zzz"; |
109 | 114 | publicstaticfinalStringHTTP_DATE_GMT_TIMEZONE ="GMT"; |
110 | 115 | publicstaticfinalintHTTP_CACHE_SECONDS =60; |
@@ -204,15 +209,15 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr |
204 | 209 | @Override |
205 | 210 | publicvoidoperationProgressed(ChannelProgressiveFuturefuture,longprogress,longtotal) { |
206 | 211 | if (total <0) {// total unknown |
207 | | -System.err.println(future.channel() +" Transfer progress: " +progress); |
| 212 | +LOGGER.info(future.channel() +" Transfer progress: " +progress); |
208 | 213 | }else { |
209 | | -System.err.println(future.channel() +" Transfer progress: " +progress +" / " +total); |
| 214 | +LOGGER.info(future.channel() +" Transfer progress: " +progress +" / " +total); |
210 | 215 | } |
211 | 216 | } |
212 | 217 |
|
213 | 218 | @Override |
214 | 219 | publicvoidoperationComplete(ChannelProgressiveFuturefuture) { |
215 | | -System.err.println(future.channel() +" Transfer complete."); |
| 220 | +LOGGER.info(future.channel() +" Transfer complete."); |
216 | 221 | } |
217 | 222 | }); |
218 | 223 |
|
|