public class MultiLineFilter extends BaseFilter
Filter
is responsible for a
String
<-> MultiLinePacket
transformations.
When reading - filter is gathering single String
lines into a MultiLinePacket,
when writing - filter breaks MultiLinePacket
into a single String
s.Constructor and Description |
---|
MultiLineFilter(String terminatingLine) |
Modifier and Type | Method and Description |
---|---|
NextAction |
handleRead(FilterChainContext ctx)
The method is called once we have received a single
String line. |
NextAction |
handleWrite(FilterChainContext ctx)
The method is called whem we send MultiLinePacket.
|
createContext, exceptionOccurred, handleAccept, handleClose, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved
public MultiLineFilter(String terminatingLine)
public NextAction handleRead(FilterChainContext ctx) throws IOException
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.handleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- Request processing contextNextAction
IOException
public NextAction handleWrite(FilterChainContext ctx) throws IOException
handleWrite
in interface Filter
handleWrite
in class BaseFilter
ctx
- Request processing contextNextAction
IOException
Copyright © 2015 Oracle Corporation. All rights reserved.