Package org.yamcs.http
Class StaticFileHandler
- java.lang.Object
-
- org.yamcs.http.StaticFileHandler
-
public class StaticFileHandler extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intHTTP_CACHE_SECONDSstatic StringHTTP_DATE_FORMATstatic StringHTTP_DATE_GMT_TIMEZONE
-
Constructor Summary
Constructors Constructor Description StaticFileHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandleStaticFileRequest(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest req, String rawPath)static voidinit(List<String> staticRoots, boolean zeroCopyEnabled)protected FilelocateFile(String path)protected voidsetContentTypeHeader(io.netty.handler.codec.http.HttpResponse response, File file)Sets the content type header for the HTTP Responseprotected static voidsetDateHeader(io.netty.handler.codec.http.HttpResponse response)Sets the Date header for the HTTP response
-
-
-
Field Detail
-
HTTP_CACHE_SECONDS
public static final int HTTP_CACHE_SECONDS
- See Also:
- Constant Field Values
-
HTTP_DATE_FORMAT
public static final String HTTP_DATE_FORMAT
- See Also:
- Constant Field Values
-
HTTP_DATE_GMT_TIMEZONE
public static final String HTTP_DATE_GMT_TIMEZONE
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init(List<String> staticRoots, boolean zeroCopyEnabled) throws ConfigurationException
- Throws:
ConfigurationException
-
handleStaticFileRequest
public void handleStaticFileRequest(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest req, String rawPath) throws IOException- Throws:
IOException
-
setContentTypeHeader
protected void setContentTypeHeader(io.netty.handler.codec.http.HttpResponse response, File file)Sets the content type header for the HTTP Response- Parameters:
file- file to extract content type
-
setDateHeader
protected static void setDateHeader(io.netty.handler.codec.http.HttpResponse response)
Sets the Date header for the HTTP response
-
-