Class MultiLineFilter

java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.samples.simpleauth.MultiLineFilter
All Implemented Interfaces:
org.glassfish.grizzly.filterchain.Filter

public class MultiLineFilter extends org.glassfish.grizzly.filterchain.BaseFilter
The Filter is responsible for a {@link List&lt;String&gt;} <-> MultiLinePacket transformations. When reading - filter is gathering String lines into a MultiLinePacket, when writing - filter breaks MultiLinePacket into String list.
Author:
Alexey Stashok
  • Constructor Summary

    Constructors
    Constructor
    Description
    MultiLineFilter(String terminatingLine)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.glassfish.grizzly.filterchain.NextAction
    handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
    The method is called once we have received a single String line.
    org.glassfish.grizzly.filterchain.NextAction
    handleWrite(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
    The method is called when we send MultiLinePacket.

    Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter

    createContext, exceptionOccurred, handleAccept, handleClose, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MultiLineFilter

      public MultiLineFilter(String terminatingLine)
  • Method Details

    • handleRead

      public org.glassfish.grizzly.filterchain.NextAction handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx) throws IOException
      The method is called once we have received a single String line. Filter check if it's MultiLinePacket terminating line, if yes - we assume MultiLinePacket completed and pass control to a next Filter in a chain. If it's not a terminating line - we add another string line to a MultiLinePacket and stop the request processing until more strings will get available.
      Specified by:
      handleRead in interface org.glassfish.grizzly.filterchain.Filter
      Overrides:
      handleRead in class org.glassfish.grizzly.filterchain.BaseFilter
      Parameters:
      ctx - Request processing context
      Returns:
      NextAction
      Throws:
      IOException
    • handleWrite

      public org.glassfish.grizzly.filterchain.NextAction handleWrite(org.glassfish.grizzly.filterchain.FilterChainContext ctx) throws IOException
      The method is called when we send MultiLinePacket.
      Specified by:
      handleWrite in interface org.glassfish.grizzly.filterchain.Filter
      Overrides:
      handleWrite in class org.glassfish.grizzly.filterchain.BaseFilter
      Parameters:
      ctx - Request processing context
      Returns:
      NextAction
      Throws:
      IOException