Package org.eclipse.jetty.server
Class ResourceContentFactory
- java.lang.Object
-
- org.eclipse.jetty.server.ResourceContentFactory
-
- All Implemented Interfaces:
HttpContent.ContentFactory
public class ResourceContentFactory extends java.lang.Object implements HttpContent.ContentFactory
An HttpContent.Factory for transient content (not cached). The HttpContent's created by this factory are not intended to be cached, so memory limits for individual HttpOutput streams are enforced.
-
-
Field Summary
Fields Modifier and Type Field Description private ResourceFactory_factoryprivate MimeTypes_mimeTypesprivate CompressedContentFormat[]_precompressedFormats
-
Constructor Summary
Constructors Constructor Description ResourceContentFactory(ResourceFactory factory, MimeTypes mimeTypes, CompressedContentFormat[] precompressedFormats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpContentgetContent(java.lang.String pathInContext, int maxBufferSize)private HttpContentload(java.lang.String pathInContext, Resource resource, int maxBufferSize)java.lang.StringtoString()
-
-
-
Field Detail
-
_factory
private final ResourceFactory _factory
-
_mimeTypes
private final MimeTypes _mimeTypes
-
_precompressedFormats
private final CompressedContentFormat[] _precompressedFormats
-
-
Constructor Detail
-
ResourceContentFactory
public ResourceContentFactory(ResourceFactory factory, MimeTypes mimeTypes, CompressedContentFormat[] precompressedFormats)
-
-
Method Detail
-
getContent
public HttpContent getContent(java.lang.String pathInContext, int maxBufferSize) throws java.io.IOException
- Specified by:
getContentin interfaceHttpContent.ContentFactory- Parameters:
pathInContext- The path within the context to the resourcemaxBufferSize- The maximum buffer to allocated for this request. For cached content, a larger buffer may have previously been allocated and returned by theHttpContent.getDirectBuffer()orHttpContent.getIndirectBuffer()calls.- Returns:
- A
HttpContent - Throws:
java.io.IOException- if unable to get content
-
load
private HttpContent load(java.lang.String pathInContext, Resource resource, int maxBufferSize) throws java.io.IOException
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-