Class AbstractDecompressingPostProcessor
java.lang.Object
org.springframework.amqp.support.postprocessor.AbstractDecompressingPostProcessor
- All Implemented Interfaces:
MessagePostProcessor,Ordered
- Direct Known Subclasses:
GUnzipPostProcessor,InflaterPostProcessor,UnzipPostProcessor
public abstract class AbstractDecompressingPostProcessor
extends Object
implements MessagePostProcessor, Ordered
Base class for post processors that decompress the message body if the
MessageProperties.SPRING_AUTO_DECOMPRESS header is true or to optionally always
decompress if the content encoding matches getEncoding(), or starts with
getEncoding() + ":", in which case the encoding following the colon becomes
the final content encoding of the decompressed message.- Since:
- 1.4.2
- Author:
- Gary Russell
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a post processor that will decompress the supported content encoding only ifMessageProperties.SPRING_AUTO_DECOMPRESSheader is present and true.AbstractDecompressingPostProcessor(boolean alwaysDecompress) Construct a post processor that will decompress the supported content encoding ifMessageProperties.SPRING_AUTO_DECOMPRESSheader is present and true or if alwaysDecompress is true. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract InputStreamgetDecompressorStream(InputStream stream) Get the stream.protected abstract StringGet the encoding.intgetOrder()postProcessMessage(Message message) Change (or replace) the message.protected voidsetOrder(int order) Set the order.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.amqp.core.MessagePostProcessor
postProcessMessage, postProcessMessage
-
Constructor Details
-
AbstractDecompressingPostProcessor
public AbstractDecompressingPostProcessor()Construct a post processor that will decompress the supported content encoding only ifMessageProperties.SPRING_AUTO_DECOMPRESSheader is present and true. -
AbstractDecompressingPostProcessor
public AbstractDecompressingPostProcessor(boolean alwaysDecompress) Construct a post processor that will decompress the supported content encoding ifMessageProperties.SPRING_AUTO_DECOMPRESSheader is present and true or if alwaysDecompress is true.- Parameters:
alwaysDecompress- true to always decompress.
-
-
Method Details
-
getOrder
public int getOrder() -
setOrder
protected void setOrder(int order) Set the order.- Parameters:
order- the order, default 0.- See Also:
-
postProcessMessage
Description copied from interface:MessagePostProcessorChange (or replace) the message.- Specified by:
postProcessMessagein interfaceMessagePostProcessor- Parameters:
message- the message.- Returns:
- the message.
- Throws:
AmqpException- an exception.
-
getDecompressorStream
Get the stream.- Parameters:
stream- The output stream to write the compressed data to.- Returns:
- the decompressor input stream.
- Throws:
IOException- IOException
-
getEncoding
Get the encoding.- Returns:
- the content-encoding header.
-