Class Compression
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.compression.Compression
- All Implemented Interfaces:
org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle
public abstract class Compression
extends org.eclipse.jetty.util.component.ContainerLifeCycle
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
LEGEND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.eclipse.jetty.io.RetainableByteBuffer.MutableacquireByteBuffer(int length) Acquire aRetainableByteBufferthat is managed by thisCompressionimplementation which is suitable for compressed output from anEncoderSinkor compressed input from aDecoderSource.protected voiddoStart()Get an etag with suffix that represents this compression implementation.intDeprecated, for removal: This API element is subject to removal in a future version.org.eclipse.jetty.io.ByteBufferPoolorg.eclipse.jetty.util.component.ContainerGet the container being used for common components.abstract org.eclipse.jetty.http.HttpFieldTheHttpFieldforContent-Encodingsuitable for this Compression implementation.abstract DecoderConfigabstract EncoderConfigThe name of the encoding if seen in the HTTP protocol in fields likeContent-EncodingorAccept-Encoding.Get the ETag suffix.The filename extensions for this compression implementation.intabstract StringgetName()abstract org.eclipse.jetty.http.HttpFieldTheHttpFieldforX-Content-Encodingsuitable for this Compression implementation.Create a newInputStreamto decode (decompress) with this compression implementation.abstract InputStreamnewDecoderInputStream(InputStream in, DecoderConfig config) Create a newInputStreamto decode (decompress) with this compression implementation.newDecoderSource(org.eclipse.jetty.io.Content.Source source) Create a newDecoderSourcefor this compression implementationabstract DecoderSourcenewDecoderSource(org.eclipse.jetty.io.Content.Source source, DecoderConfig config) Create a newDecoderSourcefor this compression implementationCreate a newOutputStreamto encode (compress) with this compression implementation.abstract OutputStreamnewEncoderOutputStream(OutputStream out, EncoderConfig config) Create a newOutputStreamto encode (compress) with this compression implementation.newEncoderSink(org.eclipse.jetty.io.Content.Sink sink) Create a newEncoderSinkfor this compression implementationabstract EncoderSinknewEncoderSink(org.eclipse.jetty.io.Content.Sink sink, EncoderConfig config) Create a newEncoderSinkfor this compression implementationvoidsetBufferSize(int size) Deprecated, for removal: This API element is subject to removal in a future version.useEncoderConfig.setBufferSize(int)orDecoderConfig.setBufferSize(int)instead.voidsetByteBufferPool(org.eclipse.jetty.io.ByteBufferPool byteBufferPool) voidsetContainer(org.eclipse.jetty.util.component.Container container) Set the container that this compression implementation should use.abstract voidsetDefaultDecoderConfig(DecoderConfig decoderConfig) abstract voidsetDefaultEncoderConfig(EncoderConfig encoderConfig) voidsetMinCompressSize(int minCompressSize) stripSuffixes(String etagsList) Strip this compression suffix off etagsMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Constructor Details
-
Compression
-
-
Method Details
-
acquireByteBuffer
public abstract org.eclipse.jetty.io.RetainableByteBuffer.Mutable acquireByteBuffer(int length) Acquire aRetainableByteBufferthat is managed by thisCompressionimplementation which is suitable for compressed output from anEncoderSinkor compressed input from aDecoderSource.It is recommended to use this method so that any compression specific details can be managed by this Compression implementation (such as ByteOrder or buffer pooling)
- Parameters:
length- the requested size of the buffer- Returns:
- the ByteBuffer suitable for this compression implementation.
-
etag
-
getBufferSize
Deprecated, for removal: This API element is subject to removal in a future version.useEncoderConfig.getBufferSize()orDecoderConfig.getBufferSize()instead.This always returns 0. -
setBufferSize
Deprecated, for removal: This API element is subject to removal in a future version.useEncoderConfig.setBufferSize(int)orDecoderConfig.setBufferSize(int)instead.This has no effect. -
getByteBufferPool
public org.eclipse.jetty.io.ByteBufferPool getByteBufferPool() -
setByteBufferPool
public void setByteBufferPool(org.eclipse.jetty.io.ByteBufferPool byteBufferPool) -
getContainer
public org.eclipse.jetty.util.component.Container getContainer()Get the container being used for common components.- Returns:
- the container for common components
-
setContainer
public void setContainer(org.eclipse.jetty.util.component.Container container) Set the container that this compression implementation should use.The container is often a source for common components (beans) that can be shared across different implementations.
- Parameters:
container- the container (often the Server itself).
-
getContentEncodingField
public abstract org.eclipse.jetty.http.HttpField getContentEncodingField()TheHttpFieldforContent-Encodingsuitable for this Compression implementation.- Returns:
- the HttpField for
Content-Encoding.
-
getDefaultDecoderConfig
-
setDefaultDecoderConfig
-
getDefaultEncoderConfig
-
setDefaultEncoderConfig
-
getEncodingName
The name of the encoding if seen in the HTTP protocol in fields likeContent-EncodingorAccept-Encoding. This name is also reused for theETagrepresentations of the compressed content.- Returns:
- the name of the Content-Encoding for this compression implementation.
-
getEtagSuffix
-
getFileExtensionNames
The filename extensions for this compression implementation.Not an exhaustive list, just the most commonly seen extensions.
- Returns:
- the list of common extension names (all lowercase) for this compression implementation. ordered by most common to least common.
-
getMinCompressSize
public int getMinCompressSize() -
setMinCompressSize
public void setMinCompressSize(int minCompressSize) -
getName
- Returns:
- the name of the compression implementation.
-
getXContentEncodingField
public abstract org.eclipse.jetty.http.HttpField getXContentEncodingField()TheHttpFieldforX-Content-Encodingsuitable for this Compression implementation.- Returns:
- the HttpField for
X-Content-Encoding.
-
newDecoderInputStream
Create a newInputStreamto decode (decompress) with this compression implementation.- Parameters:
in- the input stream to write the decoded (decompressed) bytes to- Returns:
- the
InputStreamimplementation for this compression. - Throws:
IOException- if unable to create InputStream
-
newDecoderInputStream
public abstract InputStream newDecoderInputStream(InputStream in, DecoderConfig config) throws IOException Create a newInputStreamto decode (decompress) with this compression implementation.- Parameters:
in- the input stream to write the decoded (decompressed) bytes toconfig- theDecoderConfigfor this input stream.- Returns:
- the
InputStreamimplementation for this compression. - Throws:
IOException- if unable to create InputStream
-
newDecoderSource
Create a newDecoderSourcefor this compression implementation- Parameters:
source- the source to write the decoded bytes to- Returns:
- a new
DecoderSource
-
newDecoderSource
public abstract DecoderSource newDecoderSource(org.eclipse.jetty.io.Content.Source source, DecoderConfig config) Create a newDecoderSourcefor this compression implementation- Parameters:
source- the source to write the decoded bytes toconfig- theDecoderConfigfor this source.- Returns:
- a new
DecoderSource
-
newEncoderOutputStream
Create a newOutputStreamto encode (compress) with this compression implementation.- Parameters:
out- the output stream to write the encoded (compressed) bytes to- Returns:
- the
OutputStreamimplementation for this compression. - Throws:
IOException- if unable to create OutputStream
-
newEncoderOutputStream
public abstract OutputStream newEncoderOutputStream(OutputStream out, EncoderConfig config) throws IOException Create a newOutputStreamto encode (compress) with this compression implementation.- Parameters:
out- the output stream to write the encoded (compressed) bytes toconfig- theEncoderConfigfor this output stream.- Returns:
- the
OutputStreamimplementation for this compression. - Throws:
IOException- if unable to create OutputStream
-
newEncoderSink
Create a newEncoderSinkfor this compression implementation- Parameters:
sink- the sink to write the encoded bytes to- Returns:
- a new
EncoderSink
-
newEncoderSink
public abstract EncoderSink newEncoderSink(org.eclipse.jetty.io.Content.Sink sink, EncoderConfig config) Create a newEncoderSinkfor this compression implementation- Parameters:
sink- the sink to write the encoded bytes toconfig- theEncoderConfigfor this sink.- Returns:
- a new
EncoderSink
-
stripSuffixes
-
doStart
-
EncoderConfig.getBufferSize()orDecoderConfig.getBufferSize()instead.