Interface HttpInput.Interceptor

Enclosing class:
HttpInput

@Deprecated(forRemoval=true) public static interface HttpInput.Interceptor
Deprecated, for removal: This API element is subject to removal in a future version.
Interceptor has been removed with no replacement in the EE10 implementation

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:
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Details

    • readFrom

      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      content - The content to be intercepted. The content will be modified with any data the interceptor consumes. There is no requirement that all the data is consumed by the interceptor but at least one byte must be consumed unless the returned content is the passed content instance.
      Returns:
      The intercepted content or null if interception is completed for that content.