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 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
- Author:
- Gary Russell
-
-
Field Summary
-
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
-
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 InputStream
getDecompressorStream(InputStream stream)
Get the stream.protected abstract 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
-
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 InputStream getDecompressorStream(InputStream stream) throws IOException
Get the stream.- Parameters:
stream
- The output stream to write the compressed data to.- Returns:
- the decompressor input stream.
- Throws:
IOException
- IOException
-
getEncoding
protected abstract String getEncoding()
Get the encoding.- Returns:
- the content-encoding header.
-
-