Top Inners Fields Constructors Methods
org.eclipse.jetty.server.handler.gzip

public Class GzipRequest

extends Wrapper
Class Inheritance
Imports
java.nio.ByteBuffer, java.util.ListIterator, org.eclipse.jetty.http.CompressedContentFormat, .GZIPContentDecoder, .HttpField, .HttpFields, .HttpHeader, .PreEncodedHttpField, org.eclipse.jetty.io.ByteBufferPool, .Content, .RetainableByteBuffer, org.eclipse.jetty.io.content.ContentSourceTransformer, org.eclipse.jetty.server.Components, .Request, org.eclipse.jetty.util.compression.InflaterPool

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final InflaterPool
private GzipRequest.Decoder
private final HttpFields
private GzipRequest.GzipTransformer
private static final HttpField

Constructor Summary

AccessConstructor and Description
public
GzipRequest(Request request, int inflateBufferSize)

Method Summary

Modifier and TypeMethod and Description
public void
demand(Runnable
the demand callback to invoke when there is a content chunk available.
demandCallback
)

Overrides org.eclipse.jetty.server.Request.Wrapper.demand.

Implements org.eclipse.jetty.server.Request.demand.

Demands to invoke the given demand callback parameter when a chunk of content is available.

pack-priv void
public HttpFields
public Content.Chunk
private HttpFields
updateRequestFields(Request request, boolean inflatable)

Inherited from org.eclipse.jetty.server.Request.Wrapper:
addFailureListeneraddHttpStreamWrapperaddIdleTimeoutListenerasAttributeMapclearAttributesconsumeAvailablefailgetAttributegetAttributeNameSetgetBeginNanoTimegetComponentsgetConnectionMetaDatagetContextgetHeadersNanoTimegetHttpURIgetIdgetLengthgetMethodgetSessiongetTrailersgetTunnelSupportgetWrappedisSecurepushremoveAttributesetAttribute

Field Detail

__inflaterPoolback to summary
private static final InflaterPool __inflaterPool
_decoderback to summary
private GzipRequest.Decoder _decoder
_fieldsback to summary
private final HttpFields _fields
_gzipTransformerback to summary
private GzipRequest.GzipTransformer _gzipTransformer
X_CE_GZIPback to summary
private static final HttpField X_CE_GZIP

Constructor Detail

GzipRequestback to summary
public GzipRequest(Request request, int inflateBufferSize)

Method Detail

demandback to summary
public void demand(Runnable demandCallback)

Overrides org.eclipse.jetty.server.Request.Wrapper.demand.

Implements org.eclipse.jetty.server.Request.demand.

Doc from org.eclipse.jetty.server.Request.demand.

Demands to invoke the given demand callback parameter when a chunk of content is available.

See how to use this method idiomatically.

Implementations guarantee that calls to this method are safely reentrant so that stack overflows are avoided in the case of mutual recursion between the execution of the Runnable callback and a call to this method. Invocations of the passed Runnable are serialized and a callback for demand call is not invoked until any previous demand callback has returned. Thus the Runnable should not block waiting for a callback of a future demand call.

The demand callback may be invoked spuriously: a subsequent call to read() may return null.

Calling this method establishes a pending demand, which is fulfilled when the demand callback is invoked.

Calling this method when there is already a pending demand results in an IllegalStateException to be thrown.

If the invocation of the demand callback throws an exception, then fail(Throwable) is called.

Parameters
demandCallback:Runnable

the demand callback to invoke when there is a content chunk available.

Annotations
@Override
destroyback to summary
pack-priv void destroy()
getHeadersback to summary
public HttpFields getHeaders()

Overrides org.eclipse.jetty.server.Request.Wrapper.getHeaders.

Implements org.eclipse.jetty.server.Request.getHeaders.

Returns:HttpFields

Doc from org.eclipse.jetty.server.Request.getHeaders.

the HTTP headers of this Request

Annotations
@Override
readback to summary
public Content.Chunk read()

Overrides org.eclipse.jetty.server.Request.Wrapper.read.

Implements org.eclipse.jetty.server.Request.read.

Doc from org.eclipse.jetty.server.Request.read.

Reads a chunk of content.

See how to use this method idiomatically.

The returned chunk could be:

  • null, to signal that there isn't a chunk of content available
  • an Chunk instance with non null Chunk#getFailure(), to signal that there was a failure trying to produce a chunk of content, or that the content production has been failed externally
  • a Chunk instance, containing the chunk of content.

Once a read returns an Chunk instance with non-null Chunk#getFailure() then if the failure is last further reads will continue to return the same failure chunk instance, otherwise further read() operations may return different non-failure chunks.

Once a read returns a last chunk, further reads will continue to return a last chunk (although the instance may be different).

The content reader code must ultimately arrange for a call to Chunk#release() on the returned Chunk.

Additionally, prior to the ultimate call to Chunk#release(), the reader code may make additional calls to Chunk#retain(), that must ultimately be matched by a correspondent number of calls to Chunk#release().

Concurrent reads from different threads are not recommended, as they are inherently in a race condition.

Reads performed outside the invocation context of a demand callback are allowed. However, reads performed with a pending demand are inherently in a race condition (the thread that reads with the thread that invokes the demand callback).

In addition, the returned Content.Chunk may be a Trailers instance, in case of request content trailers.

Returns:Content.Chunk

Doc from org.eclipse.jetty.io.Content.Source.read.

a chunk of content, possibly a failure instance, or null

Annotations
@Override
updateRequestFieldsback to summary
private HttpFields updateRequestFields(Request request, boolean inflatable)
org.eclipse.jetty.server.handler.gzip back to summary

pack-priv Class GzipRequest.Decoder

extends GZIPContentDecoder
Class Inheritance

Field Summary

Modifier and TypeField and Description
private RetainableByteBuffer

Constructor Summary

AccessConstructor and Description
pack-priv
Decoder(InflaterPool inflaterPool, ByteBufferPool bufferPool, int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public RetainableByteBuffer
public void
decodeChunks(ByteBuffer
the buffer of compressed data to inflate
compressed
)

Overrides org.eclipse.jetty.http.GZIPContentDecoder.decodeChunks.

Inflates compressed data.

protected boolean
decodedChunk(RetainableByteBuffer
the inflated chunk of data
decoded
)

Overrides org.eclipse.jetty.http.GZIPContentDecoder.decodedChunk.

Called when a chunk of data is inflated.

Inherited from org.eclipse.jetty.http.GZIPContentDecoder:
acquiredecodedestroyisFinished

Field Detail

_decodedback to summary
private RetainableByteBuffer _decoded

Constructor Detail

Decoderback to summary
pack-priv Decoder(InflaterPool inflaterPool, ByteBufferPool bufferPool, int bufferSize)

Method Detail

decodeback to summary
public RetainableByteBuffer decode(Content.Chunk chunk)
decodeChunksback to summary
public void decodeChunks(ByteBuffer compressed)

Overrides org.eclipse.jetty.http.GZIPContentDecoder.decodeChunks.

Doc from org.eclipse.jetty.http.GZIPContentDecoder.decodeChunks.

Inflates compressed data.

Inflation continues until the compressed block end is reached, there is no more compressed data or a call to decodedChunk(RetainableByteBuffer) returns true.

Parameters
compressed:ByteBuffer

the buffer of compressed data to inflate

Annotations
@Override
decodedChunkback to summary
protected boolean decodedChunk(RetainableByteBuffer decoded)

Overrides org.eclipse.jetty.http.GZIPContentDecoder.decodedChunk.

Doc from org.eclipse.jetty.http.GZIPContentDecoder.decodedChunk.

Called when a chunk of data is inflated.

The default implementation aggregates all the chunks into a single buffer returned from decode(ByteBuffer).

Derived implementations may choose to consume inflated chunks individually and return true from this method to prevent further inflation until a subsequent call to decode(ByteBuffer) or decodeChunks(ByteBuffer) is made.

Parameters
decoded:RetainableByteBuffer

the inflated chunk of data

Returns:boolean

false if inflating should continue, or true if the call to decodeChunks(ByteBuffer) or decode(ByteBuffer) should return, allowing to consume the inflated chunk and apply backpressure

Annotations
@Override
org.eclipse.jetty.server.handler.gzip back to summary

pack-priv Class GzipRequest.GzipTransformer

extends ContentSourceTransformer
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Content.Chunk
private final GzipRequest.Decoder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Content.Chunk
transform(Content.Chunk
a chunk read from the wrapped Content.Source
inputChunk
)

Implements abstract org.eclipse.jetty.io.content.ContentSourceTransformer.transform.

Transforms the input chunk parameter into an output chunk.

Inherited from org.eclipse.jetty.io.content.ContentSourceTransformer:
demandfailgetContentSourceread

Field Detail

_chunkback to summary
private Content.Chunk _chunk
_decoderback to summary
private final GzipRequest.Decoder _decoder

Constructor Detail

GzipTransformerback to summary
pack-priv GzipTransformer(Content.Source source, GzipRequest.Decoder decoder)

Method Detail

transformback to summary
protected Content.Chunk transform(Content.Chunk inputChunk)

Implements abstract org.eclipse.jetty.io.content.ContentSourceTransformer.transform.

Doc from org.eclipse.jetty.io.content.ContentSourceTransformer.transform.

Transforms the input chunk parameter into an output chunk.

When this method produces a non-null, non-last chunk, it is subsequently invoked with a null input chunk to try to produce more output chunks from the previous input chunk. For example, a single compressed input chunk may be transformed into multiple uncompressed output chunks.

The input chunk is released as soon as this method returns, so implementations that must hold onto the input chunk must arrange to call Content.Chunk#retain() and its correspondent Content.Chunk#release().

Implementations should return an Content.Chunk with non-null Content.Chunk#getFailure() in case of transformation errors.

Exceptions thrown by this method are equivalent to returning an error chunk.

Implementations of this method may return:

  • null, if more input chunks are necessary to produce an output chunk
  • the inputChunk itself, typically in case of non-null Content.Chunk#getFailure(), or when no transformation is required
  • a new Content.Chunk derived from inputChunk.
Parameters
inputChunk:Content.Chunk

a chunk read from the wrapped Content.Source

Returns:Content.Chunk

a transformed chunk or null

Annotations
@Override