Class AbstractDecompressingPostProcessor
- java.lang.Object
-
- org.springframework.amqp.support.postprocessor.AbstractDecompressingPostProcessor
-
- All Implemented Interfaces:
MessagePostProcessor
,org.springframework.core.Ordered
- Direct Known Subclasses:
GUnzipPostProcessor
,InflaterPostProcessor
,UnzipPostProcessor
public abstract class AbstractDecompressingPostProcessor extends java.lang.Object implements MessagePostProcessor, org.springframework.core.Ordered
Base class for post processors that decompress the message body if theMessageProperties.SPRING_AUTO_DECOMPRESS
header is true or to optionally always decompress if the content encoding matchesgetEncoding()
, or starts withgetEncoding()
+ ":", in which case the encoding following the colon becomes the final content encoding of the decompressed message.- Since:
- 1.4.2
-
-
Constructor Summary
Constructors Constructor Description AbstractDecompressingPostProcessor()
Construct a post processor that will decompress the supported content encoding only ifMessageProperties.SPRING_AUTO_DECOMPRESS
header is present and true.AbstractDecompressingPostProcessor(boolean alwaysDecompress)
Construct a post processor that will decompress the supported content encoding ifMessageProperties.SPRING_AUTO_DECOMPRESS
header is present and true or if alwaysDecompress is true.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.io.InputStream
getDecompressorStream(java.io.InputStream stream)
Get the stream.protected abstract java.lang.String
getEncoding()
Get the encoding.int
getOrder()
Message
postProcessMessage(Message message)
Change (or replace) the message.protected void
setOrder(int order)
Set the order.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.amqp.core.MessagePostProcessor
postProcessMessage, postProcessMessage
-
-
-
-
Constructor Detail
-
AbstractDecompressingPostProcessor
public AbstractDecompressingPostProcessor()
Construct a post processor that will decompress the supported content encoding only ifMessageProperties.SPRING_AUTO_DECOMPRESS
header is present and true.
-
AbstractDecompressingPostProcessor
public AbstractDecompressingPostProcessor(boolean alwaysDecompress)
Construct a post processor that will decompress the supported content encoding ifMessageProperties.SPRING_AUTO_DECOMPRESS
header is present and true or if alwaysDecompress is true.- Parameters:
alwaysDecompress
- true to always decompress.
-
-
Method Detail
-
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
setOrder
protected void setOrder(int order)
Set the order.- Parameters:
order
- the order, default 0.- See Also:
Ordered
-
postProcessMessage
public Message postProcessMessage(Message message) throws AmqpException
Description copied from interface:MessagePostProcessor
Change (or replace) the message.- Specified by:
postProcessMessage
in interfaceMessagePostProcessor
- Parameters:
message
- the message.- Returns:
- the message.
- Throws:
AmqpException
- an exception.
-
getDecompressorStream
protected abstract java.io.InputStream getDecompressorStream(java.io.InputStream stream) throws java.io.IOException
Get the stream.- Parameters:
stream
- The output stream to write the compressed data to.- Returns:
- the decompressor input stream.
- Throws:
java.io.IOException
- IOException
-
getEncoding
protected abstract java.lang.String getEncoding()
Get the encoding.- Returns:
- the content-encoding header.
-
-