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 int
HTTP_CACHE_SECONDS
static String
HTTP_DATE_FORMAT
static String
HTTP_DATE_GMT_TIMEZONE
-
Constructor Summary
Constructors Constructor Description StaticFileHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handleStaticFileRequest(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest req, String rawPath)
static void
init(List<String> staticRoots, boolean zeroCopyEnabled)
protected File
locateFile(String path)
protected void
setContentTypeHeader(io.netty.handler.codec.http.HttpResponse response, File file)
Sets the content type header for the HTTP Responseprotected static void
setDateHeader(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
-
-