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
  • Constructor Details

    • AbstractDecompressingPostProcessor

      public AbstractDecompressingPostProcessor()
      Construct a post processor that will decompress the supported content encoding only if MessageProperties.SPRING_AUTO_DECOMPRESS header is present and true.
    • AbstractDecompressingPostProcessor

      public AbstractDecompressingPostProcessor(boolean alwaysDecompress)
      Construct a post processor that will decompress the supported content encoding if MessageProperties.SPRING_AUTO_DECOMPRESS header is present and true or if alwaysDecompress is true.
      Parameters:
      alwaysDecompress - true to always decompress.
  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface Ordered
    • setOrder

      protected void setOrder(int order)
      Set the order.
      Parameters:
      order - the order, default 0.
      See Also:
    • postProcessMessage

      public Message postProcessMessage(Message message) throws AmqpException
      Description copied from interface: MessagePostProcessor
      Change (or replace) the message.
      Specified by:
      postProcessMessage in interface MessagePostProcessor
      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.