com.sun.grizzly.arp
Class AsyncProtocolFilter

java.lang.Object
  extended by com.sun.grizzly.http.DefaultProtocolFilter
      extended by com.sun.grizzly.arp.AsyncProtocolFilter
All Implemented Interfaces:
TaskListener, ProtocolFilter
Direct Known Subclasses:
SSLAsyncProtocolFilter

public class AsyncProtocolFilter
extends DefaultProtocolFilter
implements TaskListener

A ProtocolFilter that allow asynchronous http request processing.

Author:
Jeanfrancois Arcand

Field Summary
protected  int bbSize
          Default size for ByteBuffer.
protected  Interceptor<ByteBuffer,SocketChannel> interceptor
          Interceptor used when determining if a request must be handled directly inside this ProtocolFilter.
 
Fields inherited from class com.sun.grizzly.http.DefaultProtocolFilter
address, algorithmClass, logger, port
 
Fields inherited from interface com.sun.grizzly.ProtocolFilter
SUCCESSFUL_READ
 
Constructor Summary
AsyncProtocolFilter(Class algorithmClass, InetAddress address, int port)
          Constructs a new AsyncProtocolFilter .
AsyncProtocolFilter(Class algorithmClass, int port)
          Deprecated. use AsyncProtocolFilter(Class, java.net.InetAddress, int)
 
Method Summary
protected  void configureInputBuffer(InputReader inputStream, Context context, HttpWorkerThread workerThread)
          Configure InputReader.
protected  void configureProcessorTask(ProcessorTask processorTask, Context context, StreamAlgorithm streamAlgorithm, InputStream inputStream)
          Configure SSLProcessorTask.
protected  InputReader createInputReader()
          Creates InputReader
 boolean execute(Context ctx)
          Execute a unit of processing work to be performed.
 Interceptor<ByteBuffer,SocketChannel> getInterceptor()
          Return the current Interceptor
 void setInterceptor(Interceptor<ByteBuffer,SocketChannel> interceptor)
          Set the Interceptor used to decide if the request must be handled by this ProtocolFilter directly.
 void taskEvent(TaskEvent event)
          Called when the Asynchronous Request Processing is resuming.
 
Methods inherited from class com.sun.grizzly.http.DefaultProtocolFilter
configureProcessorTask, isSecure, postExecute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bbSize

protected int bbSize
Default size for ByteBuffer.


interceptor

protected Interceptor<ByteBuffer,SocketChannel> interceptor
Interceptor used when determining if a request must be handled directly inside this ProtocolFilter.

Constructor Detail

AsyncProtocolFilter

@Deprecated
public AsyncProtocolFilter(Class algorithmClass,
                                      int port)
Deprecated. use AsyncProtocolFilter(Class, java.net.InetAddress, int)

Invokes AsyncProtocolFilter(Class, java.net.InetAddress, int) with a null InetAddress.

Parameters:
algorithmClass - the StreamAlgorithm
port - the network port to associate with this filter

AsyncProtocolFilter

public AsyncProtocolFilter(Class algorithmClass,
                           InetAddress address,
                           int port)
Constructs a new AsyncProtocolFilter .

Parameters:
algorithmClass - the StreamAlgorithm
address - the network address to associate with this filter
port - the network port to associate with this filter
Method Detail

execute

public boolean execute(Context ctx)
                throws IOException
Execute a unit of processing work to be performed. This ProtocolFilter may either complete the required processing and return false, or delegate remaining processing to the next ProtocolFilter in a ProtocolChain containing this ProtocolFilter by returning true.

Specified by:
execute in interface ProtocolFilter
Overrides:
execute in class DefaultProtocolFilter
Parameters:
ctx - Context
Returns:
Throws:
IOException

taskEvent

public void taskEvent(TaskEvent event)
Called when the Asynchronous Request Processing is resuming.

Specified by:
taskEvent in interface TaskListener

configureProcessorTask

protected void configureProcessorTask(ProcessorTask processorTask,
                                      Context context,
                                      StreamAlgorithm streamAlgorithm,
                                      InputStream inputStream)
Configure SSLProcessorTask.


configureInputBuffer

protected void configureInputBuffer(InputReader inputStream,
                                    Context context,
                                    HttpWorkerThread workerThread)
Configure InputReader.

Overrides:
configureInputBuffer in class DefaultProtocolFilter

createInputReader

protected InputReader createInputReader()
Creates InputReader


getInterceptor

public Interceptor<ByteBuffer,SocketChannel> getInterceptor()
Return the current Interceptor

Returns:
the current Interceptor

setInterceptor

public void setInterceptor(Interceptor<ByteBuffer,SocketChannel> interceptor)
Set the Interceptor used to decide if the request must be handled by this ProtocolFilter directly.

Parameters:
interceptor - the Interceptor


Copyright © 2012 Oracle Corporation. All Rights Reserved.