com.sun.grizzly.filter
Class ParserProtocolFilter
java.lang.Object
com.sun.grizzly.filter.ReadFilter
com.sun.grizzly.filter.ParserProtocolFilter
- All Implemented Interfaces:
- ProtocolFilter
- Direct Known Subclasses:
- ResourceAllocationFilter
public abstract class ParserProtocolFilter
- extends ReadFilter
Simple ProtocolFilter implementation which read the available bytes
and delegate the decision of reading more bytes or not to a ProtocolParser.
The ProtocolParser will decide if more bytes are required before continuing
the invokation of the ProtocolChain.
- Author:
- Jeanfrancois Arcand
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ParserProtocolFilter
public ParserProtocolFilter()
execute
public boolean execute(Context ctx)
throws IOException
- Read available bytes and delegate the processing of them to the next
ProtocolFilter in the ProtocolChain.
- Specified by:
execute
in interface ProtocolFilter
- Overrides:
execute
in class ReadFilter
- Parameters:
ctx
- Context
- Returns:
- true if the next ProtocolFilter on the ProtocolChain
need to be invoked.
- Throws:
IOException
invokeProtocolParser
protected boolean invokeProtocolParser(Context ctx,
ProtocolParser parser)
- Invoke the
ProtocolParser
. If more bytes are required,
register the SelectionKey
back to its associated
SelectorHandler
- Parameters:
ctx
- the Context object.
- Returns:
- true if no more bytes are needed.
postExecute
public boolean postExecute(Context context)
throws IOException
- Description copied from class:
ReadFilter
- If no bytes were available, close the connection by cancelling the
SelectionKey. If bytes were available, register the SelectionKey
for new bytes.
- Specified by:
postExecute
in interface ProtocolFilter
- Overrides:
postExecute
in class ReadFilter
- Parameters:
context
- Context
- Returns:
- true if the previous ProtocolFilter postExecute method
needs to be invoked.
- Throws:
IOException
newProtocolParser
public abstract ProtocolParser newProtocolParser()
- Return a new or cached ProtocolParser instance.
Copyright © 2008 SUN Microsystems. All Rights Reserved.