Top Inners Fields Constructors Methods
org.eclipse.jetty.http.content

public Class FileMappingHttpContentFactory

extends Object
implements Factory
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.http.content.HttpContent.Factory
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.Objects, org.eclipse.jetty.util.BufferUtil, org.eclipse.jetty.util.thread.AutoLock, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final HttpContent.Factory
private final int
private static final int
private static final Logger

Constructor Summary

AccessConstructor and Description
public
FileMappingHttpContentFactory(HttpContent.Factory
the wrapped HttpContent.Factory to use.
factory
)

Construct a FileMappingHttpContentFactory which can use file mapped buffers.

public
FileMappingHttpContentFactory(HttpContent.Factory
the wrapped HttpContent.Factory to use.
factory
,
int
the minimum size of an HttpContent before trying to use a file mapped buffer.
minFileSize
)

Construct a FileMappingHttpContentFactory which can use file mapped buffers.

Method Summary

Modifier and TypeMethod and Description
public HttpContent
getContent(String
The path within the context to the resource
path
)

Implements org.eclipse.jetty.http.content.HttpContent.Factory.getContent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_factoryback to summary
private final HttpContent.Factory _factory
_minFileSizeback to summary
private final int _minFileSize
DEFAULT_MIN_FILE_SIZEback to summary
private static final int DEFAULT_MIN_FILE_SIZE
LOGback to summary
private static final Logger LOG

Constructor Detail

FileMappingHttpContentFactoryback to summary
public FileMappingHttpContentFactory(HttpContent.Factory factory)

Construct a FileMappingHttpContentFactory which can use file mapped buffers. Uses a default value of 16384 for the minimum size of an HttpContent before trying to use a file mapped buffer.

Parameters
factory:HttpContent.Factory

the wrapped HttpContent.Factory to use.

FileMappingHttpContentFactoryback to summary
public FileMappingHttpContentFactory(HttpContent.Factory factory, int minFileSize)

Construct a FileMappingHttpContentFactory which can use file mapped buffers.

Parameters
factory:HttpContent.Factory

the wrapped HttpContent.Factory to use.

minFileSize:int

the minimum size of an HttpContent before trying to use a file mapped buffer.

Method Detail

getContentback to summary
public HttpContent getContent(String path) throws IOException

Implements org.eclipse.jetty.http.content.HttpContent.Factory.getContent.

Parameters
path:String

Doc from org.eclipse.jetty.http.content.HttpContent.Factory.getContent.

The path within the context to the resource

Returns:HttpContent

Doc from org.eclipse.jetty.http.content.HttpContent.Factory.getContent.

A HttpContent

Annotations
@Override
Exceptions
IOException:

Doc from org.eclipse.jetty.http.content.HttpContent.Factory.getContent.

if unable to get content

org.eclipse.jetty.http.content back to summary

private Class FileMappingHttpContentFactory.FileMappedHttpContent

extends Wrapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
private volatile ByteBuffer
private final HttpContent
private final AutoLock
private static final ByteBuffer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer
public long
private ByteBuffer
Inherited from org.eclipse.jetty.http.content.HttpContent.Wrapper:
getCharacterEncodinggetContentEncodinggetContentEncodingValuegetContentLengthgetContentLengthValuegetContentTypegetContentTypeValuegetETaggetETagValuegetLastModifiedgetLastModifiedInstantgetLastModifiedValuegetMimeTypegetPreCompressedContentFormatsgetResourcegetWrappedreleasetoString

Field Detail

_bufferback to summary
private volatile ByteBuffer _buffer
_contentback to summary
private final HttpContent _content
_lockback to summary
private final AutoLock _lock
SENTINEL_BUFFERback to summary
private static final ByteBuffer SENTINEL_BUFFER

Constructor Detail

FileMappedHttpContentback to summary
public FileMappedHttpContent(HttpContent content)

Method Detail

getByteBufferback to summary
public ByteBuffer getByteBuffer()

Overrides org.eclipse.jetty.http.content.HttpContent.Wrapper.getByteBuffer.

Implements org.eclipse.jetty.http.content.HttpContent.getByteBuffer.

Doc from org.eclipse.jetty.http.content.HttpContent.getByteBuffer.

Get this HTTP content as a ByteBuffer if possible.

Each invocation returns a new ByteBuffer instance that is read-only and contains valid data between the pos and the limit.

Returns:ByteBuffer

a ByteBuffer instance or null.

Annotations
@Override
getBytesOccupiedback to summary
public long getBytesOccupied()

Overrides org.eclipse.jetty.http.content.HttpContent.Wrapper.getBytesOccupied.

Overrides default org.eclipse.jetty.http.content.HttpContent.getBytesOccupied.

Annotations
@Override
getMappedByteBufferback to summary
private ByteBuffer getMappedByteBuffer()