@ChannelHandler.Sharable
public class HistoryServerStaticFileServerHandler
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.router.Routed>
HistoryServer
that serves requests to web frontend's static files,
such as HTML, CSS, JS or JSON files.
This code is based on the "HttpStaticFileServerHandler" from the Netty project's HTTP server
example.
This class is a copy of the StaticFileServerHandler
. The differences are that the request path is
modified to end on ".json" if it does not have a filename extension; when "index.html" is requested we load
"index_hs.html" instead to inject the modified HistoryServer WebInterface and that the caching of the "/joboverview"
page is prevented.Constructor and Description |
---|
HistoryServerStaticFileServerHandler(File rootPath) |
Modifier and Type | Method and Description |
---|---|
void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.router.Routed routed) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
handlerAdded, handlerRemoved, isSharable
public HistoryServerStaticFileServerHandler(File rootPath) throws IOException
IOException
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.router.Routed routed) throws Exception
channelRead0
in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.router.Routed>
Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.