|
|
|
@ -4,6 +4,7 @@ import io.netty.channel.ChannelHandler |
|
|
|
|
import io.netty.channel.ChannelHandlerContext |
|
|
|
|
import io.netty.channel.SimpleChannelInboundHandler |
|
|
|
|
import io.netty.handler.codec.http.HttpHeaderValues |
|
|
|
|
import io.netty.handler.codec.http.HttpMethod |
|
|
|
|
import io.netty.handler.codec.http.HttpRequest |
|
|
|
|
import io.netty.handler.codec.http.HttpResponseStatus |
|
|
|
|
import io.netty.handler.timeout.IdleStateEvent |
|
|
|
@ -28,6 +29,11 @@ public class HttpChannelHandler @Inject constructor( |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (msg.method() != HttpMethod.HEAD && msg.method() != HttpMethod.GET) { |
|
|
|
|
Http.writeResponse(ctx, msg, HttpResponseStatus.METHOD_NOT_ALLOWED) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fileProvider.get(uri.substring(1)).use { file -> |
|
|
|
|
if (file == null) { |
|
|
|
|
Http.writeResponse(ctx, msg, HttpResponseStatus.NOT_FOUND) |
|
|
|
|