com.sun.grizzly.standalone
Class StaticHandler

java.lang.Object
  extended by com.sun.grizzly.standalone.StaticHandler
All Implemented Interfaces:
Interceptor<Request,SocketChannel>

public class StaticHandler
extends Object
implements Interceptor<Request,SocketChannel>

This Interceptor is invoked after the request line has been parsed.

Author:
Jeanfrancois Arcand

Field Summary
protected  FileCache fileCache
          The FileCache mechanism used to cache static resources.
protected  SocketChannel socketChannel
          The SocketChannel used to send a static resources.
 
Fields inherited from interface com.sun.grizzly.util.Interceptor
BREAK, CONTINUE, REQUEST_BUFFERED, REQUEST_LINE_PARSED, RESPONSE_PROCEEDED
 
Constructor Summary
StaticHandler()
           
 
Method Summary
 void attachChannel(SocketChannel socketChannel)
          Attach a SocketChannel to this object.
protected  int findBytes(ByteChunk bc, byte[] b)
          Specialized utility method: find a sequence of lower case bytes inside a ByteChunk.
 int handle(Request req, int handlerCode)
          Intercept the request and decide if we cache the static resource.
protected  boolean keepAlive(Request request)
          Get the keep-alive header.
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socketChannel

protected SocketChannel socketChannel
The SocketChannel used to send a static resources.


fileCache

protected FileCache fileCache
The FileCache mechanism used to cache static resources.

Constructor Detail

StaticHandler

public StaticHandler()
Method Detail

attachChannel

public void attachChannel(SocketChannel socketChannel)
Attach a SocketChannel to this object.

Specified by:
attachChannel in interface Interceptor<Request,SocketChannel>

handle

public int handle(Request req,
                  int handlerCode)
           throws IOException
Intercept the request and decide if we cache the static resource. If the static resource is already cached, return it.

Specified by:
handle in interface Interceptor<Request,SocketChannel>
Returns:
Throws:
IOException

keepAlive

protected boolean keepAlive(Request request)
Get the keep-alive header.


findBytes

protected int findBytes(ByteChunk bc,
                        byte[] b)
Specialized utility method: find a sequence of lower case bytes inside a ByteChunk.


reset

public void reset()


Copyright © 2012 Oracle Corporation. All Rights Reserved.