Methods Summary |
---|
public java.nio.ByteBuffer | allocate(boolean useDirect, boolean useView, int size)Allocate a ByteBuffer
throw new UnsupportedOperationException();
|
public int | contentLength()Return the stream content-length. If the content-length wasn't parsed,
return -1.
throw new UnsupportedOperationException();
|
private java.lang.String | dump(java.nio.ByteBuffer byteBuffer)Dump the ByteBuffer content. This is used only for debugging purpose.
ByteBuffer dd = byteBuffer.duplicate();
dd.flip();
int length = dd.limit();
byte[] dump = new byte[length];
dd.get(dump,0,length);
return(new String(dump) + "\n----------------------------" + dd);
|
public com.sun.enterprise.web.connector.grizzly.Handler | getHandler()Return null as handler aren't required.
return null;
|
public int | getPort()Return the port
return port;
|
public java.lang.Class | getReadTask(com.sun.enterprise.web.connector.grizzly.SelectorThread selectorThread)Return the class responsible for handling OP_READ.
return com.sun.enterprise.web.connector.grizzly.DefaultReadTask.class;
|
public int | headerLength()Return the stream header length. The header length is the length between
the start of the stream and the first occurance of character '\r\n' .
throw new UnsupportedOperationException();
|
public boolean | parse(java.nio.ByteBuffer byteBuffer)Parse the request line in search of the context-root bytes of the HTTP
Method. The ByteBuffer position and limit refer
respectively to the start and the end of the context root.
boolean isFound = false;
int curPosition = byteBuffer.position();
int curLimit = byteBuffer.limit();
// Rule a - If nothing, return to the Selector.
if (byteBuffer.position() == 0)
return false;
byteBuffer.position(0);
byteBuffer.limit(curPosition);
int state =0;
int start =0;
int end = 0;
try {
byte c;
// Rule b - try to determine the context-root
while(byteBuffer.hasRemaining()) {
c = byteBuffer.get();
// State Machine
// 0 - Search for the first SPACE ' ' between the method and the
// the request URI
// 1 - Search for the second SPACE ' ' between the request URI
// and the method
switch(state) {
case 0: // Search for first ' '
if (c == 0x20){
state = 1;
start = byteBuffer.position() + 1;
}
break;
case 1: // Search for next ' '
if (c == 0x20){
end = byteBuffer.position() - 1;
return true;
}
break;
default:
throw new IllegalArgumentException("Unexpected state");
}
}
return false;
} catch (BufferUnderflowException bue) {
return false;
} finally {
if ( end > 0 ){
byteBuffer.position(start);
byteBuffer.limit(end);
} else {
byteBuffer.limit(curLimit);
byteBuffer.position(curPosition);
}
}
|
public java.nio.ByteBuffer | postParse(java.nio.ByteBuffer byteBuffer)After parsing the bytes, post process the ByteBuffer
throw new UnsupportedOperationException();
|
public java.nio.ByteBuffer | preParse(java.nio.ByteBuffer byteBuffer)Before parsing the bytes, initialize and prepare the algorithm.
throw new UnsupportedOperationException();
|
public void | recycle()Recycle the algorithm.
|
public java.nio.ByteBuffer | rollbackParseState(java.nio.ByteBuffer byteBuffer)Rollback the ByteBuffer to its previous state in case
an error as occured.
throw new UnsupportedOperationException();
|
public void | setPort(int port)Set the port
this.port = port;
|
public void | setSocketChannel(java.nio.channels.SocketChannel socketChannel)Set the SocketChannel used by this class.
this.socketChannel = socketChannel;
|