java.lang.Object
org.klomp.snark.web.BasicServlet.FileContent
- All Implemented Interfaces:
BasicServlet.HttpContent
- Direct Known Subclasses:
BasicServlet.LimitFileContent
- Enclosing class:
BasicServlet
HTTP content backed by a file on disk.
Field Summary
Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionintThe cache time.longThe content length.The content type.The input stream.longThe last modified time.toString()String form of the content.
Field Details
_file
The file to serve.
Constructor Details
FileContent
Method Details
getContentType
The content type.- Specified by:
getContentTypein interfaceBasicServlet.HttpContent- Returns:
- the MIME type for the response header
getLastModified
public long getLastModified()The last modified time.- Specified by:
getLastModifiedin interfaceBasicServlet.HttpContent- Returns:
- the last modified
getCacheTime
public int getCacheTime()The cache time.- Specified by:
getCacheTimein interfaceBasicServlet.HttpContent- Returns:
- max-age in seconds for the Cache-Control header
getContentLength
public long getContentLength()The content length.- Specified by:
getContentLengthin interfaceBasicServlet.HttpContent- Returns:
- the byte length for the Content-Length header
getInputStream
The input stream.- Specified by:
getInputStreamin interfaceBasicServlet.HttpContent- Returns:
- a stream over the response body
- Throws:
IOException- if the content cannot be opened for reading
toString