|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.web.connector.grizzly.algorithms.StreamAlgorithmBase
public abstract class StreamAlgorithmBase
Base class for StreamAlgorithm implementation.
| Nested Class Summary | |
|---|---|
static class |
StreamAlgorithmBase.DummyHandler
Empty handler used when Grizzly is bundled outside of GlassFish. |
| Field Summary | |
|---|---|
protected int |
contentLength
The actual length of the stream we are able to read. |
protected int |
curLimit
The ByteBuffer current limit value |
protected int |
curPosition
The ByteBuffer current position value |
protected static boolean |
embeddedInGlassFish
Is Grizzly embedded in GlassFish. |
protected Handler |
handler
An Handler implementation used to implement a
static resources cache. |
protected int |
headerLength
The position, within the ByteBuffer, when the HTTP
headers are completely reads. |
protected int |
lastStatePosition
In case we were'nt able to parse the request line, we will continue parsing from that position. |
protected ByteBuffer |
primaryByteBuffer
If a new ByteBuffer is created because the stream is
too small, cache the original byteBuffer and reuse it once the
transaction has completed. |
protected SocketChannel |
socketChannel
The SocketChannel associated with this algorithm. |
protected int |
state
If the stream wasn't read fully, keep the state of the http parsing. |
protected boolean |
useByteBufferView
If true, use a ByteBuffer view instead of
ByteBuffer |
protected boolean |
useDirectByteBuffer
Are we using direct ByteBuffer |
| Constructor Summary | |
|---|---|
StreamAlgorithmBase()
|
|
| Method Summary | |
|---|---|
ByteBuffer |
allocate(boolean useDirectByteBuffer,
boolean useByteBufferView,
int size)
Allocate a ByteBuffer |
int |
contentLength()
Return the stream content-length. |
protected String |
dump(ByteBuffer byteBuffer)
Dump the ByteBuffer content. |
int |
getPort()
Return the port |
Class |
getReadTask(SelectorThread selectorThread)
Return the full name of the class responsible for handling OP_READ. |
int |
headerLength()
Return the stream header length. |
abstract boolean |
parse(ByteBuffer byteBuffer)
Manipulate the bytes stream and determine if the process can continue. |
ByteBuffer |
postParse(ByteBuffer byteBuffer)
After parsing the bytes, post process the ByteBuffer |
ByteBuffer |
preParse(ByteBuffer byteBuffer)
Before parsing the bytes, initialize and prepare the algorithm. |
void |
recycle()
Reset this object to its default state. |
ByteBuffer |
rollbackParseState(ByteBuffer byteBuffer)
Rollback the ByteBuffer to its previous state in case
an error as occured. |
void |
setPort(int port)
Set the port |
void |
setSocketChannel(SocketChannel socketChannel)
The SocketChannel used by this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.enterprise.web.connector.grizzly.StreamAlgorithm |
|---|
getHandler |
| Field Detail |
|---|
protected static boolean embeddedInGlassFish
protected int contentLength
protected int curLimit
ByteBuffer current limit value
protected int curPosition
ByteBuffer current position value
protected int headerLength
ByteBuffer, when the HTTP
headers are completely reads.
protected int lastStatePosition
protected int state
protected ByteBuffer primaryByteBuffer
ByteBuffer is created because the stream is
too small, cache the original byteBuffer and reuse it once the
transaction has completed.
protected boolean useByteBufferView
true, use a ByteBuffer view instead of
ByteBuffer
protected boolean useDirectByteBuffer
ByteBuffer
protected SocketChannel socketChannel
SocketChannel associated with this algorithm.
protected Handler handler
Handler implementation used to implement a
static resources cache.
| Constructor Detail |
|---|
public StreamAlgorithmBase()
| Method Detail |
|---|
public abstract boolean parse(ByteBuffer byteBuffer)
parse in interface StreamAlgorithmpublic int contentLength()
contentLength in interface StreamAlgorithmpublic int headerLength()
headerLength in interface StreamAlgorithmpublic ByteBuffer preParse(ByteBuffer byteBuffer)
preParse in interface StreamAlgorithmbyteBuffer - the ByteBuffer used by this algorithm
ByteBuffer used by this algorithmpublic ByteBuffer postParse(ByteBuffer byteBuffer)
ByteBuffer
postParse in interface StreamAlgorithmbyteBuffer - the ByteBuffer used by this algorithm
ByteBuffer used by this algorithmpublic void recycle()
recycle in interface StreamAlgorithm
public ByteBuffer allocate(boolean useDirectByteBuffer,
boolean useByteBufferView,
int size)
ByteBuffer
allocate in interface StreamAlgorithmuseDirectByteBuffer - to create a direct ByteBufferuseByteBufferView - to create ByteBuffer viewsize - the size of the ByteBuffer
ByteBufferpublic ByteBuffer rollbackParseState(ByteBuffer byteBuffer)
ByteBuffer to its previous state in case
an error as occured.
rollbackParseState in interface StreamAlgorithmprotected String dump(ByteBuffer byteBuffer)
public void setSocketChannel(SocketChannel socketChannel)
setSocketChannel in interface StreamAlgorithmpublic void setPort(int port)
setPort in interface StreamAlgorithmpublic int getPort()
getPort in interface StreamAlgorithmpublic Class getReadTask(SelectorThread selectorThread)
getReadTask in interface StreamAlgorithm
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||