public class io.netty.example.http.file.HttpStaticFileServerHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
minor version: 0
major version: 59
flags: flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: io.netty.example.http.file.HttpStaticFileServerHandler
super_class: io.netty.channel.SimpleChannelInboundHandler
{
public static final java.lang.String HTTP_DATE_FORMAT;
descriptor: Ljava/lang/String;
flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
ConstantValue: "EEE, dd MMM yyyy HH:mm:ss zzz"
public static final java.lang.String HTTP_DATE_GMT_TIMEZONE;
descriptor: Ljava/lang/String;
flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
ConstantValue: "GMT"
public static final int HTTP_CACHE_SECONDS;
descriptor: I
flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
ConstantValue: 60
private static final java.util.regex.Pattern INSECURE_URI;
descriptor: Ljava/util/regex/Pattern;
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
private static final java.util.regex.Pattern ALLOWED_FILE_NAME;
descriptor: Ljava/util/regex/Pattern;
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
static void <clinit>();
descriptor: ()V
flags: (0x0008) ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: ldc ".*[<>&\"].*"
invokestatic java.util.regex.Pattern.compile:(Ljava/lang/String;)Ljava/util/regex/Pattern;
putstatic io.netty.example.http.file.HttpStaticFileServerHandler.INSECURE_URI:Ljava/util/regex/Pattern;
1: ldc "[^-\\._]?[^<>&\\\"]*"
invokestatic java.util.regex.Pattern.compile:(Ljava/lang/String;)Ljava/util/regex/Pattern;
putstatic io.netty.example.http.file.HttpStaticFileServerHandler.ALLOWED_FILE_NAME:Ljava/util/regex/Pattern;
return
LocalVariableTable:
Start End Slot Name Signature
public void <init>();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
start local 0 0: aload 0
invokespecial io.netty.channel.SimpleChannelInboundHandler.<init>:()V
return
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 this Lio/netty/example/http/file/HttpStaticFileServerHandler;
public void channelRead0(io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.http.FullHttpRequest);
descriptor: (Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/FullHttpRequest;)V
flags: (0x0001) ACC_PUBLIC
Code:
stack=11, locals=13, args_size=3
start local 0 start local 1 start local 2 0: aload 2
invokeinterface io.netty.handler.codec.http.FullHttpRequest.decoderResult:()Lio/netty/handler/codec/DecoderResult;
invokevirtual io.netty.handler.codec.DecoderResult.isSuccess:()Z
ifne 3
1: aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
2: return
3: StackMap locals:
StackMap stack:
aload 2
invokeinterface io.netty.handler.codec.http.FullHttpRequest.method:()Lio/netty/handler/codec/http/HttpMethod;
getstatic io.netty.handler.codec.http.HttpMethod.GET:Lio/netty/handler/codec/http/HttpMethod;
if_acmpeq 6
4: aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
5: return
6: StackMap locals:
StackMap stack:
aload 2
invokeinterface io.netty.handler.codec.http.FullHttpRequest.uri:()Ljava/lang/String;
astore 3
start local 3 7: aload 3
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sanitizeUri:(Ljava/lang/String;)Ljava/lang/String;
astore 4
start local 4 8: aload 4
ifnonnull 11
9: aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
10: return
11: StackMap locals: java.lang.String java.lang.String
StackMap stack:
new java.io.File
dup
aload 4
invokespecial java.io.File.<init>:(Ljava/lang/String;)V
astore 5
start local 5 12: aload 5
invokevirtual java.io.File.isHidden:()Z
ifne 13
aload 5
invokevirtual java.io.File.exists:()Z
ifne 15
13: StackMap locals: java.io.File
StackMap stack:
aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
14: return
15: StackMap locals:
StackMap stack:
aload 5
invokevirtual java.io.File.isDirectory:()Z
ifeq 21
16: aload 3
ldc "/"
invokevirtual java.lang.String.endsWith:(Ljava/lang/String;)Z
ifeq 19
17: aload 1
aload 5
aload 3
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendListing:(Lio/netty/channel/ChannelHandlerContext;Ljava/io/File;Ljava/lang/String;)V
18: goto 20
19: StackMap locals:
StackMap stack:
aload 1
new java.lang.StringBuilder
dup
aload 3
invokestatic java.lang.String.valueOf:(Ljava/lang/Object;)Ljava/lang/String;
invokespecial java.lang.StringBuilder.<init>:(Ljava/lang/String;)V
bipush 47
invokevirtual java.lang.StringBuilder.append:(C)Ljava/lang/StringBuilder;
invokevirtual java.lang.StringBuilder.toString:()Ljava/lang/String;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendRedirect:(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/String;)V
20: StackMap locals:
StackMap stack:
return
21: StackMap locals:
StackMap stack:
aload 5
invokevirtual java.io.File.isFile:()Z
ifne 24
22: aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
23: return
24: StackMap locals:
StackMap stack:
aload 2
invokeinterface io.netty.handler.codec.http.FullHttpRequest.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.IF_MODIFIED_SINCE:Lio/netty/util/AsciiString;
invokevirtual io.netty.handler.codec.http.HttpHeaders.get:(Ljava/lang/CharSequence;)Ljava/lang/String;
astore 6
start local 6 25: aload 6
ifnull 33
aload 6
invokevirtual java.lang.String.isEmpty:()Z
ifne 33
26: new java.text.SimpleDateFormat
dup
ldc "EEE, dd MMM yyyy HH:mm:ss zzz"
getstatic java.util.Locale.US:Ljava/util/Locale;
invokespecial java.text.SimpleDateFormat.<init>:(Ljava/lang/String;Ljava/util/Locale;)V
astore 7
start local 7 27: aload 7
aload 6
invokevirtual java.text.SimpleDateFormat.parse:(Ljava/lang/String;)Ljava/util/Date;
astore 8
start local 8 28: aload 8
invokevirtual java.util.Date.getTime:()J
ldc 1000
ldiv
lstore 9
start local 9 29: aload 5
invokevirtual java.io.File.lastModified:()J
ldc 1000
ldiv
lstore 11
start local 11 30: lload 9
lload 11
lcmp
ifne 33
31: aload 1
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendNotModified:(Lio/netty/channel/ChannelHandlerContext;)V
32: return
end local 11 end local 9 end local 8 end local 7 33: StackMap locals: java.lang.String
StackMap stack:
new java.io.RandomAccessFile
dup
aload 5
ldc "r"
invokespecial java.io.RandomAccessFile.<init>:(Ljava/io/File;Ljava/lang/String;)V
astore 7
start local 7 34: goto 38
end local 7 StackMap locals:
StackMap stack: java.io.FileNotFoundException
35: pop
36: aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
37: return
start local 7 38: StackMap locals: java.io.RandomAccessFile
StackMap stack:
aload 7
invokevirtual java.io.RandomAccessFile.length:()J
lstore 8
start local 8 39: new io.netty.handler.codec.http.DefaultHttpResponse
dup
getstatic io.netty.handler.codec.http.HttpVersion.HTTP_1_1:Lio/netty/handler/codec/http/HttpVersion;
getstatic io.netty.handler.codec.http.HttpResponseStatus.OK:Lio/netty/handler/codec/http/HttpResponseStatus;
invokespecial io.netty.handler.codec.http.DefaultHttpResponse.<init>:(Lio/netty/handler/codec/http/HttpVersion;Lio/netty/handler/codec/http/HttpResponseStatus;)V
astore 10
start local 10 40: aload 10
lload 8
invokestatic io.netty.handler.codec.http.HttpUtil.setContentLength:(Lio/netty/handler/codec/http/HttpMessage;J)V
41: aload 10
aload 5
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.setContentTypeHeader:(Lio/netty/handler/codec/http/HttpResponse;Ljava/io/File;)V
42: aload 10
aload 5
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.setDateAndCacheHeaders:(Lio/netty/handler/codec/http/HttpResponse;Ljava/io/File;)V
43: aload 2
invokestatic io.netty.handler.codec.http.HttpUtil.isKeepAlive:(Lio/netty/handler/codec/http/HttpMessage;)Z
ifeq 45
44: aload 10
invokeinterface io.netty.handler.codec.http.HttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.CONNECTION:Lio/netty/util/AsciiString;
getstatic io.netty.handler.codec.http.HttpHeaderValues.KEEP_ALIVE:Lio/netty/util/AsciiString;
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
45: StackMap locals: long io.netty.handler.codec.http.HttpResponse
StackMap stack:
aload 1
aload 10
invokeinterface io.netty.channel.ChannelHandlerContext.write:(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;
pop
46: aload 1
invokeinterface io.netty.channel.ChannelHandlerContext.pipeline:()Lio/netty/channel/ChannelPipeline;
ldc Lio/netty/handler/ssl/SslHandler;
invokeinterface io.netty.channel.ChannelPipeline.get:(Ljava/lang/Class;)Lio/netty/channel/ChannelHandler;
ifnonnull 51
47: aload 1
new io.netty.channel.DefaultFileRegion
dup
aload 7
invokevirtual java.io.RandomAccessFile.getChannel:()Ljava/nio/channels/FileChannel;
lconst_0
lload 8
invokespecial io.netty.channel.DefaultFileRegion.<init>:(Ljava/nio/channels/FileChannel;JJ)V
aload 1
invokeinterface io.netty.channel.ChannelHandlerContext.newProgressivePromise:()Lio/netty/channel/ChannelProgressivePromise;
invokeinterface io.netty.channel.ChannelHandlerContext.write:(Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;
48: astore 11
start local 11 49: aload 1
getstatic io.netty.handler.codec.http.LastHttpContent.EMPTY_LAST_CONTENT:Lio/netty/handler/codec/http/LastHttpContent;
invokeinterface io.netty.channel.ChannelHandlerContext.writeAndFlush:(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;
astore 12
start local 12 50: goto 56
end local 12 end local 11 51: StackMap locals:
StackMap stack:
aload 1
new io.netty.handler.codec.http.HttpChunkedInput
dup
new io.netty.handler.stream.ChunkedFile
dup
aload 7
lconst_0
lload 8
sipush 8192
invokespecial io.netty.handler.stream.ChunkedFile.<init>:(Ljava/io/RandomAccessFile;JJI)V
invokespecial io.netty.handler.codec.http.HttpChunkedInput.<init>:(Lio/netty/handler/stream/ChunkedInput;)V
52: aload 1
invokeinterface io.netty.channel.ChannelHandlerContext.newProgressivePromise:()Lio/netty/channel/ChannelProgressivePromise;
53: invokeinterface io.netty.channel.ChannelHandlerContext.writeAndFlush:(Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;
54: astore 11
start local 11 55: aload 11
astore 12
start local 12 56: StackMap locals: io.netty.channel.ChannelFuture io.netty.channel.ChannelFuture
StackMap stack:
aload 11
new io.netty.example.http.file.HttpStaticFileServerHandler$1
dup
aload 0
invokespecial io.netty.example.http.file.HttpStaticFileServerHandler$1.<init>:(Lio/netty/example/http/file/HttpStaticFileServerHandler;)V
invokeinterface io.netty.channel.ChannelFuture.addListener:(Lio/netty/util/concurrent/GenericFutureListener;)Lio/netty/channel/ChannelFuture;
pop
57: aload 2
invokestatic io.netty.handler.codec.http.HttpUtil.isKeepAlive:(Lio/netty/handler/codec/http/HttpMessage;)Z
ifne 59
58: aload 12
getstatic io.netty.channel.ChannelFutureListener.CLOSE:Lio/netty/channel/ChannelFutureListener;
invokeinterface io.netty.channel.ChannelFuture.addListener:(Lio/netty/util/concurrent/GenericFutureListener;)Lio/netty/channel/ChannelFuture;
pop
59: StackMap locals:
StackMap stack:
return
end local 12 end local 11 end local 10 end local 8 end local 7 end local 6 end local 5 end local 4 end local 3 end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 60 0 this Lio/netty/example/http/file/HttpStaticFileServerHandler;
0 60 1 ctx Lio/netty/channel/ChannelHandlerContext;
0 60 2 request Lio/netty/handler/codec/http/FullHttpRequest;
7 60 3 uri Ljava/lang/String;
8 60 4 path Ljava/lang/String;
12 60 5 file Ljava/io/File;
25 60 6 ifModifiedSince Ljava/lang/String;
27 33 7 dateFormatter Ljava/text/SimpleDateFormat;
28 33 8 ifModifiedSinceDate Ljava/util/Date;
29 33 9 ifModifiedSinceDateSeconds J
30 33 11 fileLastModifiedSeconds J
34 35 7 raf Ljava/io/RandomAccessFile;
38 60 7 raf Ljava/io/RandomAccessFile;
39 60 8 fileLength J
40 60 10 response Lio/netty/handler/codec/http/HttpResponse;
49 51 11 sendFileFuture Lio/netty/channel/ChannelFuture;
55 60 11 sendFileFuture Lio/netty/channel/ChannelFuture;
50 51 12 lastContentFuture Lio/netty/channel/ChannelFuture;
56 60 12 lastContentFuture Lio/netty/channel/ChannelFuture;
Exception table:
from to target type
33 34 35 Class java.io.FileNotFoundException
Exceptions:
throws java.lang.Exception
MethodParameters:
Name Flags
ctx
request
public void exceptionCaught(io.netty.channel.ChannelHandlerContext, java.lang.Throwable);
descriptor: (Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Throwable;)V
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=3, args_size=3
start local 0 start local 1 start local 2 0: aload 2
invokevirtual java.lang.Throwable.printStackTrace:()V
1: aload 1
invokeinterface io.netty.channel.ChannelHandlerContext.channel:()Lio/netty/channel/Channel;
invokeinterface io.netty.channel.Channel.isActive:()Z
ifeq 3
2: aload 1
getstatic io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR:Lio/netty/handler/codec/http/HttpResponseStatus;
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.sendError:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
3: StackMap locals:
StackMap stack:
return
end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 4 0 this Lio/netty/example/http/file/HttpStaticFileServerHandler;
0 4 1 ctx Lio/netty/channel/ChannelHandlerContext;
0 4 2 cause Ljava/lang/Throwable;
MethodParameters:
Name Flags
ctx
cause
private static java.lang.String sanitizeUri(java.lang.String);
descriptor: (Ljava/lang/String;)Ljava/lang/String;
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=4, locals=2, args_size=1
start local 0 0: aload 0
ldc "UTF-8"
invokestatic java.net.URLDecoder.decode:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
astore 0
1: goto 4
StackMap locals:
StackMap stack: java.io.UnsupportedEncodingException
2: astore 1
start local 1 3: new java.lang.Error
dup
aload 1
invokespecial java.lang.Error.<init>:(Ljava/lang/Throwable;)V
athrow
end local 1 4: StackMap locals:
StackMap stack:
aload 0
invokevirtual java.lang.String.isEmpty:()Z
ifne 5
aload 0
iconst_0
invokevirtual java.lang.String.charAt:(I)C
bipush 47
if_icmpeq 6
5: StackMap locals:
StackMap stack:
aconst_null
areturn
6: StackMap locals:
StackMap stack:
aload 0
bipush 47
getstatic java.io.File.separatorChar:C
invokevirtual java.lang.String.replace:(CC)Ljava/lang/String;
astore 0
7: aload 0
new java.lang.StringBuilder
dup
getstatic java.io.File.separator:Ljava/lang/String;
invokestatic java.lang.String.valueOf:(Ljava/lang/Object;)Ljava/lang/String;
invokespecial java.lang.StringBuilder.<init>:(Ljava/lang/String;)V
bipush 46
invokevirtual java.lang.StringBuilder.append:(C)Ljava/lang/StringBuilder;
invokevirtual java.lang.StringBuilder.toString:()Ljava/lang/String;
invokevirtual java.lang.String.contains:(Ljava/lang/CharSequence;)Z
ifne 11
8: aload 0
new java.lang.StringBuilder
dup
bipush 46
invokestatic java.lang.String.valueOf:(C)Ljava/lang/String;
invokespecial java.lang.StringBuilder.<init>:(Ljava/lang/String;)V
getstatic java.io.File.separator:Ljava/lang/String;
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
invokevirtual java.lang.StringBuilder.toString:()Ljava/lang/String;
invokevirtual java.lang.String.contains:(Ljava/lang/CharSequence;)Z
ifne 11
9: aload 0
iconst_0
invokevirtual java.lang.String.charAt:(I)C
bipush 46
if_icmpeq 11
aload 0
aload 0
invokevirtual java.lang.String.length:()I
iconst_1
isub
invokevirtual java.lang.String.charAt:(I)C
bipush 46
if_icmpeq 11
10: getstatic io.netty.example.http.file.HttpStaticFileServerHandler.INSECURE_URI:Ljava/util/regex/Pattern;
aload 0
invokevirtual java.util.regex.Pattern.matcher:(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
invokevirtual java.util.regex.Matcher.matches:()Z
ifeq 12
11: StackMap locals:
StackMap stack:
aconst_null
areturn
12: StackMap locals:
StackMap stack:
new java.lang.StringBuilder
dup
ldc "user.dir"
invokestatic io.netty.util.internal.SystemPropertyUtil.get:(Ljava/lang/String;)Ljava/lang/String;
invokestatic java.lang.String.valueOf:(Ljava/lang/Object;)Ljava/lang/String;
invokespecial java.lang.StringBuilder.<init>:(Ljava/lang/String;)V
getstatic java.io.File.separator:Ljava/lang/String;
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
aload 0
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
invokevirtual java.lang.StringBuilder.toString:()Ljava/lang/String;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 13 0 uri Ljava/lang/String;
3 4 1 e Ljava/io/UnsupportedEncodingException;
Exception table:
from to target type
0 1 2 Class java.io.UnsupportedEncodingException
MethodParameters:
Name Flags
uri
private static void sendListing(io.netty.channel.ChannelHandlerContext, java.io.File, java.lang.String);
descriptor: (Lio/netty/channel/ChannelHandlerContext;Ljava/io/File;Ljava/lang/String;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=4, locals=10, args_size=3
start local 0 start local 1 start local 2 0: new io.netty.handler.codec.http.DefaultFullHttpResponse
dup
getstatic io.netty.handler.codec.http.HttpVersion.HTTP_1_1:Lio/netty/handler/codec/http/HttpVersion;
getstatic io.netty.handler.codec.http.HttpResponseStatus.OK:Lio/netty/handler/codec/http/HttpResponseStatus;
invokespecial io.netty.handler.codec.http.DefaultFullHttpResponse.<init>:(Lio/netty/handler/codec/http/HttpVersion;Lio/netty/handler/codec/http/HttpResponseStatus;)V
astore 3
start local 3 1: aload 3
invokeinterface io.netty.handler.codec.http.FullHttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE:Lio/netty/util/AsciiString;
ldc "text/html; charset=UTF-8"
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
2: new java.lang.StringBuilder
dup
invokespecial java.lang.StringBuilder.<init>:()V
3: ldc "<!DOCTYPE html>\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
4: ldc "<html><head><meta charset='utf-8' /><title>"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
5: ldc "Listing of: "
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
6: aload 2
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
7: ldc "</title></head><body>\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
8: ldc "<h3>Listing of: "
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
9: aload 2
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
10: ldc "</h3>\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
11: ldc "<ul>"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
12: ldc "<li><a href=\"../\">..</a></li>\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
13: astore 4
start local 4 14: aload 1
invokevirtual java.io.File.listFiles:()[Ljava/io/File;
dup
astore 8
arraylength
istore 7
iconst_0
istore 6
goto 27
StackMap locals: io.netty.channel.ChannelHandlerContext java.io.File java.lang.String io.netty.handler.codec.http.FullHttpResponse java.lang.StringBuilder top int int java.io.File[]
StackMap stack:
15: aload 8
iload 6
aaload
astore 5
start local 5 16: aload 5
invokevirtual java.io.File.isHidden:()Z
ifne 26
aload 5
invokevirtual java.io.File.canRead:()Z
ifne 18
17: goto 26
18: StackMap locals: io.netty.channel.ChannelHandlerContext java.io.File java.lang.String io.netty.handler.codec.http.FullHttpResponse java.lang.StringBuilder java.io.File int int java.io.File[]
StackMap stack:
aload 5
invokevirtual java.io.File.getName:()Ljava/lang/String;
astore 9
start local 9 19: getstatic io.netty.example.http.file.HttpStaticFileServerHandler.ALLOWED_FILE_NAME:Ljava/util/regex/Pattern;
aload 9
invokevirtual java.util.regex.Pattern.matcher:(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
invokevirtual java.util.regex.Matcher.matches:()Z
ifne 21
20: goto 26
21: StackMap locals: java.lang.String
StackMap stack:
aload 4
ldc "<li><a href=\""
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
22: aload 9
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
23: ldc "\">"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
24: aload 9
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
25: ldc "</a></li>\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
pop
end local 9 end local 5 26: StackMap locals: io.netty.channel.ChannelHandlerContext java.io.File java.lang.String io.netty.handler.codec.http.FullHttpResponse java.lang.StringBuilder top int int java.io.File[]
StackMap stack:
iinc 6 1
StackMap locals:
StackMap stack:
27: iload 6
iload 7
if_icmplt 15
28: aload 4
ldc "</ul></body></html>\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
pop
29: aload 4
getstatic io.netty.util.CharsetUtil.UTF_8:Ljava/nio/charset/Charset;
invokestatic io.netty.buffer.Unpooled.copiedBuffer:(Ljava/lang/CharSequence;Ljava/nio/charset/Charset;)Lio/netty/buffer/ByteBuf;
astore 5
start local 5 30: aload 3
invokeinterface io.netty.handler.codec.http.FullHttpResponse.content:()Lio/netty/buffer/ByteBuf;
aload 5
invokevirtual io.netty.buffer.ByteBuf.writeBytes:(Lio/netty/buffer/ByteBuf;)Lio/netty/buffer/ByteBuf;
pop
31: aload 5
invokevirtual io.netty.buffer.ByteBuf.release:()Z
pop
32: aload 0
aload 3
invokeinterface io.netty.channel.ChannelHandlerContext.writeAndFlush:(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;
getstatic io.netty.channel.ChannelFutureListener.CLOSE:Lio/netty/channel/ChannelFutureListener;
invokeinterface io.netty.channel.ChannelFuture.addListener:(Lio/netty/util/concurrent/GenericFutureListener;)Lio/netty/channel/ChannelFuture;
pop
33: return
end local 5 end local 4 end local 3 end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 34 0 ctx Lio/netty/channel/ChannelHandlerContext;
0 34 1 dir Ljava/io/File;
0 34 2 dirPath Ljava/lang/String;
1 34 3 response Lio/netty/handler/codec/http/FullHttpResponse;
14 34 4 buf Ljava/lang/StringBuilder;
16 26 5 f Ljava/io/File;
19 26 9 name Ljava/lang/String;
30 34 5 buffer Lio/netty/buffer/ByteBuf;
MethodParameters:
Name Flags
ctx
dir
dirPath
private static void sendRedirect(io.netty.channel.ChannelHandlerContext, java.lang.String);
descriptor: (Lio/netty/channel/ChannelHandlerContext;Ljava/lang/String;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=4, locals=3, args_size=2
start local 0 start local 1 0: new io.netty.handler.codec.http.DefaultFullHttpResponse
dup
getstatic io.netty.handler.codec.http.HttpVersion.HTTP_1_1:Lio/netty/handler/codec/http/HttpVersion;
getstatic io.netty.handler.codec.http.HttpResponseStatus.FOUND:Lio/netty/handler/codec/http/HttpResponseStatus;
invokespecial io.netty.handler.codec.http.DefaultFullHttpResponse.<init>:(Lio/netty/handler/codec/http/HttpVersion;Lio/netty/handler/codec/http/HttpResponseStatus;)V
astore 2
start local 2 1: aload 2
invokeinterface io.netty.handler.codec.http.FullHttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.LOCATION:Lio/netty/util/AsciiString;
aload 1
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
2: aload 0
aload 2
invokeinterface io.netty.channel.ChannelHandlerContext.writeAndFlush:(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;
getstatic io.netty.channel.ChannelFutureListener.CLOSE:Lio/netty/channel/ChannelFutureListener;
invokeinterface io.netty.channel.ChannelFuture.addListener:(Lio/netty/util/concurrent/GenericFutureListener;)Lio/netty/channel/ChannelFuture;
pop
3: return
end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 4 0 ctx Lio/netty/channel/ChannelHandlerContext;
0 4 1 newUri Ljava/lang/String;
1 4 2 response Lio/netty/handler/codec/http/FullHttpResponse;
MethodParameters:
Name Flags
ctx
newUri
private static void sendError(io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.http.HttpResponseStatus);
descriptor: (Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/HttpResponseStatus;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=7, locals=3, args_size=2
start local 0 start local 1 0: new io.netty.handler.codec.http.DefaultFullHttpResponse
dup
1: getstatic io.netty.handler.codec.http.HttpVersion.HTTP_1_1:Lio/netty/handler/codec/http/HttpVersion;
aload 1
new java.lang.StringBuilder
dup
ldc "Failure: "
invokespecial java.lang.StringBuilder.<init>:(Ljava/lang/String;)V
aload 1
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
ldc "\r\n"
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
invokevirtual java.lang.StringBuilder.toString:()Ljava/lang/String;
getstatic io.netty.util.CharsetUtil.UTF_8:Ljava/nio/charset/Charset;
invokestatic io.netty.buffer.Unpooled.copiedBuffer:(Ljava/lang/CharSequence;Ljava/nio/charset/Charset;)Lio/netty/buffer/ByteBuf;
2: invokespecial io.netty.handler.codec.http.DefaultFullHttpResponse.<init>:(Lio/netty/handler/codec/http/HttpVersion;Lio/netty/handler/codec/http/HttpResponseStatus;Lio/netty/buffer/ByteBuf;)V
astore 2
start local 2 3: aload 2
invokeinterface io.netty.handler.codec.http.FullHttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE:Lio/netty/util/AsciiString;
ldc "text/plain; charset=UTF-8"
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
4: aload 0
aload 2
invokeinterface io.netty.channel.ChannelHandlerContext.writeAndFlush:(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;
getstatic io.netty.channel.ChannelFutureListener.CLOSE:Lio/netty/channel/ChannelFutureListener;
invokeinterface io.netty.channel.ChannelFuture.addListener:(Lio/netty/util/concurrent/GenericFutureListener;)Lio/netty/channel/ChannelFuture;
pop
5: return
end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 6 0 ctx Lio/netty/channel/ChannelHandlerContext;
0 6 1 status Lio/netty/handler/codec/http/HttpResponseStatus;
3 6 2 response Lio/netty/handler/codec/http/FullHttpResponse;
MethodParameters:
Name Flags
ctx
status
private static void sendNotModified(io.netty.channel.ChannelHandlerContext);
descriptor: (Lio/netty/channel/ChannelHandlerContext;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=4, locals=2, args_size=1
start local 0 0: new io.netty.handler.codec.http.DefaultFullHttpResponse
dup
getstatic io.netty.handler.codec.http.HttpVersion.HTTP_1_1:Lio/netty/handler/codec/http/HttpVersion;
getstatic io.netty.handler.codec.http.HttpResponseStatus.NOT_MODIFIED:Lio/netty/handler/codec/http/HttpResponseStatus;
invokespecial io.netty.handler.codec.http.DefaultFullHttpResponse.<init>:(Lio/netty/handler/codec/http/HttpVersion;Lio/netty/handler/codec/http/HttpResponseStatus;)V
astore 1
start local 1 1: aload 1
invokestatic io.netty.example.http.file.HttpStaticFileServerHandler.setDateHeader:(Lio/netty/handler/codec/http/FullHttpResponse;)V
2: aload 0
aload 1
invokeinterface io.netty.channel.ChannelHandlerContext.writeAndFlush:(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;
getstatic io.netty.channel.ChannelFutureListener.CLOSE:Lio/netty/channel/ChannelFutureListener;
invokeinterface io.netty.channel.ChannelFuture.addListener:(Lio/netty/util/concurrent/GenericFutureListener;)Lio/netty/channel/ChannelFuture;
pop
3: return
end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 4 0 ctx Lio/netty/channel/ChannelHandlerContext;
1 4 1 response Lio/netty/handler/codec/http/FullHttpResponse;
MethodParameters:
Name Flags
ctx
private static void setDateHeader(io.netty.handler.codec.http.FullHttpResponse);
descriptor: (Lio/netty/handler/codec/http/FullHttpResponse;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=4, locals=3, args_size=1
start local 0 0: new java.text.SimpleDateFormat
dup
ldc "EEE, dd MMM yyyy HH:mm:ss zzz"
getstatic java.util.Locale.US:Ljava/util/Locale;
invokespecial java.text.SimpleDateFormat.<init>:(Ljava/lang/String;Ljava/util/Locale;)V
astore 1
start local 1 1: aload 1
ldc "GMT"
invokestatic java.util.TimeZone.getTimeZone:(Ljava/lang/String;)Ljava/util/TimeZone;
invokevirtual java.text.SimpleDateFormat.setTimeZone:(Ljava/util/TimeZone;)V
2: new java.util.GregorianCalendar
dup
invokespecial java.util.GregorianCalendar.<init>:()V
astore 2
start local 2 3: aload 0
invokeinterface io.netty.handler.codec.http.FullHttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.DATE:Lio/netty/util/AsciiString;
aload 1
aload 2
invokevirtual java.util.Calendar.getTime:()Ljava/util/Date;
invokevirtual java.text.SimpleDateFormat.format:(Ljava/util/Date;)Ljava/lang/String;
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
4: return
end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 5 0 response Lio/netty/handler/codec/http/FullHttpResponse;
1 5 1 dateFormatter Ljava/text/SimpleDateFormat;
3 5 2 time Ljava/util/Calendar;
MethodParameters:
Name Flags
response
private static void setDateAndCacheHeaders(io.netty.handler.codec.http.HttpResponse, java.io.File);
descriptor: (Lio/netty/handler/codec/http/HttpResponse;Ljava/io/File;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=7, locals=4, args_size=2
start local 0 start local 1 0: new java.text.SimpleDateFormat
dup
ldc "EEE, dd MMM yyyy HH:mm:ss zzz"
getstatic java.util.Locale.US:Ljava/util/Locale;
invokespecial java.text.SimpleDateFormat.<init>:(Ljava/lang/String;Ljava/util/Locale;)V
astore 2
start local 2 1: aload 2
ldc "GMT"
invokestatic java.util.TimeZone.getTimeZone:(Ljava/lang/String;)Ljava/util/TimeZone;
invokevirtual java.text.SimpleDateFormat.setTimeZone:(Ljava/util/TimeZone;)V
2: new java.util.GregorianCalendar
dup
invokespecial java.util.GregorianCalendar.<init>:()V
astore 3
start local 3 3: aload 0
invokeinterface io.netty.handler.codec.http.HttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.DATE:Lio/netty/util/AsciiString;
aload 2
aload 3
invokevirtual java.util.Calendar.getTime:()Ljava/util/Date;
invokevirtual java.text.SimpleDateFormat.format:(Ljava/util/Date;)Ljava/lang/String;
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
4: aload 3
bipush 13
bipush 60
invokevirtual java.util.Calendar.add:(II)V
5: aload 0
invokeinterface io.netty.handler.codec.http.HttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.EXPIRES:Lio/netty/util/AsciiString;
aload 2
aload 3
invokevirtual java.util.Calendar.getTime:()Ljava/util/Date;
invokevirtual java.text.SimpleDateFormat.format:(Ljava/util/Date;)Ljava/lang/String;
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
6: aload 0
invokeinterface io.netty.handler.codec.http.HttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.CACHE_CONTROL:Lio/netty/util/AsciiString;
ldc "private, max-age=60"
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
7: aload 0
invokeinterface io.netty.handler.codec.http.HttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
8: getstatic io.netty.handler.codec.http.HttpHeaderNames.LAST_MODIFIED:Lio/netty/util/AsciiString;
aload 2
new java.util.Date
dup
aload 1
invokevirtual java.io.File.lastModified:()J
invokespecial java.util.Date.<init>:(J)V
invokevirtual java.text.SimpleDateFormat.format:(Ljava/util/Date;)Ljava/lang/String;
9: invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
10: return
end local 3 end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 11 0 response Lio/netty/handler/codec/http/HttpResponse;
0 11 1 fileToCache Ljava/io/File;
1 11 2 dateFormatter Ljava/text/SimpleDateFormat;
3 11 3 time Ljava/util/Calendar;
MethodParameters:
Name Flags
response
fileToCache
private static void setContentTypeHeader(io.netty.handler.codec.http.HttpResponse, java.io.File);
descriptor: (Lio/netty/handler/codec/http/HttpResponse;Ljava/io/File;)V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=4, locals=3, args_size=2
start local 0 start local 1 0: new javax.activation.MimetypesFileTypeMap
dup
invokespecial javax.activation.MimetypesFileTypeMap.<init>:()V
astore 2
start local 2 1: aload 0
invokeinterface io.netty.handler.codec.http.HttpResponse.headers:()Lio/netty/handler/codec/http/HttpHeaders;
getstatic io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE:Lio/netty/util/AsciiString;
aload 2
aload 1
invokevirtual java.io.File.getPath:()Ljava/lang/String;
invokevirtual javax.activation.MimetypesFileTypeMap.getContentType:(Ljava/lang/String;)Ljava/lang/String;
invokevirtual io.netty.handler.codec.http.HttpHeaders.set:(Ljava/lang/CharSequence;Ljava/lang/Object;)Lio/netty/handler/codec/http/HttpHeaders;
pop
2: return
end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 3 0 response Lio/netty/handler/codec/http/HttpResponse;
0 3 1 file Ljava/io/File;
1 3 2 mimeTypesMap Ljavax/activation/MimetypesFileTypeMap;
MethodParameters:
Name Flags
response
file
public void channelRead0(io.netty.channel.ChannelHandlerContext, java.lang.Object);
descriptor: (Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;)V
flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
stack=3, locals=3, args_size=3
0: aload 0
aload 1
aload 2
checkcast io.netty.handler.codec.http.FullHttpRequest
invokevirtual io.netty.example.http.file.HttpStaticFileServerHandler.channelRead0:(Lio/netty/channel/ChannelHandlerContext;Lio/netty/handler/codec/http/FullHttpRequest;)V
return
LocalVariableTable:
Start End Slot Name Signature
Exceptions:
throws java.lang.Exception
}
Signature: Lio/netty/channel/SimpleChannelInboundHandler<Lio/netty/handler/codec/http/FullHttpRequest;>;
SourceFile: "HttpStaticFileServerHandler.java"
NestMembers:
io.netty.example.http.file.HttpStaticFileServerHandler$1
InnerClasses:
io.netty.example.http.file.HttpStaticFileServerHandler$1