Interface HttpInput.Interceptor

All Known Implementing Classes:
GzipHttpInputInterceptor
Enclosing class:
HttpInput

public static interface HttpInput.Interceptor

HttpInput.Content interceptor that can be registered using HttpInput.setInterceptor(Interceptor) or HttpInput.addInterceptor(Interceptor). When HttpInput.Content instances are generated, they are passed to the registered interceptor (if any) that is then responsible for providing the actual content that is consumed by HttpInput.read(byte[], int, int) and its sibling methods.

A minimal implementation could be as simple as:
 public HttpInput.Content readFrom(HttpInput.Content content)
 {
     LOGGER.debug("read content: {}", asString(content));
     return content;
 }
 
which would not do anything with the content besides logging it. A more involved implementation could look like the following:
 public HttpInput.Content readFrom(HttpInput.Content content)
 {
     if (content.hasContent())
         this.processedContent = processContent(content.getByteBuffer());
     if (content.isEof())
         disposeResources();
     return content.isSpecial() ? content : this.processedContent;
 }
 
Implementors of this interface must keep the following in mind:
See Also: