com.sun.enterprise.web.connector.grizzly.algorithms
Class SeekHeaderAlgorithm
java.lang.Object
com.sun.enterprise.web.connector.grizzly.algorithms.StreamAlgorithmBase
com.sun.enterprise.web.connector.grizzly.algorithms.ContentLengthAlgorithm
com.sun.enterprise.web.connector.grizzly.algorithms.SeekHeaderAlgorithm
- All Implemented Interfaces:
- StreamAlgorithm
public final class SeekHeaderAlgorithm
- extends ContentLengthAlgorithm
Predict if the NIO channel has been fully read or not. This lagorithm will
first search for the content-length header, and use that value to determine if
the bytes has been fully read or not. If the content-length isn't included,
it will search for the end of the HTTP stream, which is a '\r\n' without
buffering the body.
- Author:
- Jean-Francois Arcand
| Fields inherited from class com.sun.enterprise.web.connector.grizzly.algorithms.StreamAlgorithmBase |
contentLength, curLimit, curPosition, embeddedInGlassFish, handler, headerLength, lastStatePosition, primaryByteBuffer, socketChannel, state, useByteBufferView, useDirectByteBuffer |
|
Method Summary |
boolean |
parse(ByteBuffer byteBuffer)
Parse the ByteBuffer and try to determine if the bytes
stream has been fully read from the SocketChannel. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SeekHeaderAlgorithm
public SeekHeaderAlgorithm()
parse
public boolean parse(ByteBuffer byteBuffer)
- Parse the
ByteBuffer and try to determine if the bytes
stream has been fully read from the SocketChannel.
Drain the SocketChannel and determine if the request bytes
has been fully read. For POST method, parse the bytes and seek for the
content-type header to determine the length of the request bytes.
- Specified by:
parse in interface StreamAlgorithm- Overrides:
parse in class ContentLengthAlgorithm
- Returns:
- true if we need to call back the
SelectorThread
This occurs when the stream doesn't contains all the
request bytes.
false if the stream contains all request bytes.
Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.