|
15 | 15 | */
|
16 | 16 | package org.asynchttpclient.reactivestreams;
|
17 | 17 |
|
| 18 | +import static io.netty.handler.codec.http.HttpHeaders.Names.*; |
| 19 | +import static io.netty.handler.codec.http.HttpMethod.GET; |
| 20 | +import static io.netty.handler.codec.http.HttpResponseStatus.*; |
| 21 | +import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; |
18 | 22 | import io.netty.buffer.ByteBuf;
|
19 | 23 | import io.netty.buffer.Unpooled;
|
20 | 24 | import io.netty.channel.ChannelFuture;
|
|
36 | 40 | import io.netty.handler.ssl.SslHandler;
|
37 | 41 | import io.netty.handler.stream.ChunkedFile;
|
38 | 42 | import io.netty.util.CharsetUtil;
|
| 43 | + |
39 | 44 | import java.io.File;
|
40 | 45 | import java.io.FileNotFoundException;
|
41 | 46 | import java.io.RandomAccessFile;
|
|
48 | 53 | import java.util.Locale;
|
49 | 54 | import java.util.TimeZone;
|
50 | 55 | import java.util.regex.Pattern;
|
| 56 | + |
51 | 57 | import javax.activation.MimetypesFileTypeMap;
|
52 |
| -import org.asynchttpclient.test.TestUtils; |
53 | 58 |
|
54 |
| -import static io.netty.handler.codec.http.HttpHeaders.Names.*; |
55 |
| -import static io.netty.handler.codec.http.HttpMethod.GET; |
56 |
| -import static io.netty.handler.codec.http.HttpResponseStatus.*; |
57 |
| -import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; |
| 59 | +import org.asynchttpclient.test.TestUtils; |
| 60 | +import org.slf4j.Logger; |
| 61 | +import org.slf4j.LoggerFactory; |
58 | 62 |
|
59 | 63 |
|
60 | 64 | /**
|
|
105 | 109 | */
|
106 | 110 | public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
|
107 | 111 |
|
| 112 | + private static final Logger LOGGER = LoggerFactory.getLogger(HttpStaticFileServerHandler.class); |
108 | 113 | public static final String HTTP_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
|
109 | 114 | public static final String HTTP_DATE_GMT_TIMEZONE = "GMT";
|
110 | 115 | public static final int HTTP_CACHE_SECONDS = 60;
|
@@ -204,15 +209,15 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr
|
204 | 209 | @Override
|
205 | 210 | public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) {
|
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 | public void operationComplete(ChannelProgressiveFuture future) {
|
215 |
| - System.err.println(future.channel() + " Transfer complete."); |
| 220 | + LOGGER.info(future.channel() + " Transfer complete."); |
216 | 221 | }
|
217 | 222 | });
|
218 | 223 |
|
|
0 commit comments