Class EagerContentHandler.RetainedContentLoaderFactory
java.lang.Object
org.eclipse.jetty.server.handler.EagerContentHandler.RetainedContentLoaderFactory
- All Implemented Interfaces:
EagerContentHandler.ContentLoaderFactory
- Enclosing class:
EagerContentHandler
public static class EagerContentHandler.RetainedContentLoaderFactory
extends Object
implements EagerContentHandler.ContentLoaderFactory
An
EagerContentHandler.ContentLoaderFactory
for any content, that uses Retainable.retain()
to
eagerly load content with zero copies, until all content is read or a maximum size is exceeded.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Delay dispatch until all content or an effective buffer size is reached -
Constructor Summary
ConstructorsConstructorDescriptionCreates aRetainedContentLoaderFactory
with heuristically determined values for the maximum number bytes to retain and the number of bytes to include in the estimated size perContent.Chunk
to allow for framing overheads in the transport and no rejection of the request when the maximum number bytes to retain is exceeded.RetainedContentLoaderFactory
(long maxRetainedBytes, int framingOverhead, boolean reject) Creates aRetainedContentLoaderFactory
. -
Method Summary
-
Constructor Details
-
RetainedContentLoaderFactory
public RetainedContentLoaderFactory()Creates aRetainedContentLoaderFactory
with heuristically determined values for the maximum number bytes to retain and the number of bytes to include in the estimated size perContent.Chunk
to allow for framing overheads in the transport and no rejection of the request when the maximum number bytes to retain is exceeded. -
RetainedContentLoaderFactory
public RetainedContentLoaderFactory(long maxRetainedBytes, int framingOverhead, boolean reject) Creates aRetainedContentLoaderFactory
.- Parameters:
maxRetainedBytes
- the maximum number bytes to retain whilst eagerly loading, which includes the content bytes and anyframingOverhead
per chunk; or -1 for a heuristically determined value that will not increase memory commitment.framingOverhead
- the number of bytes to include in the estimated size perContent.Chunk
to allow for framing overheads in the transport. Since the content is retained rather than copied, any framing data is also retained in the IO buffer; or -1 for a heuristically determined value.reject
- iftrue
, then ifmaxRetainBytes
is exceeded, the request is rejected with aHttpStatus.PAYLOAD_TOO_LARGE_413
response.
-
-
Method Details
-
getApplicableMimeType
- Specified by:
getApplicableMimeType
in interfaceEagerContentHandler.ContentLoaderFactory
- Returns:
- The mimetype for which this factory is applicable to; or
null
if applicable to all types.
-
newContentLoader
public EagerContentHandler.ContentLoader newContentLoader(String contentType, String mimeType, Handler handler, Request request, Response response, Callback callback) - Specified by:
newContentLoader
in interfaceEagerContentHandler.ContentLoaderFactory
- Parameters:
contentType
- The content type of the requestmimeType
- The mime type extracted from the requesthandler
- The next handler to callrequest
- The requestresponse
- The responsecallback
- The callback- Returns:
- An
EagerContentHandler.ContentLoader
instance if the content can be loaded eagerly, elsenull
.
-