public class HttpRequest extends AbstractHttpRequest implements ProtocolConnection
Modifier and Type | Field and Description |
---|---|
static int |
HTTP_0_9 |
static int |
HTTP_1_0 |
static int |
HTTP_1_1 |
_headerCodes, JSP_EXCEPTION, SHUTDOWN, TOKEN
Constructor and Description |
---|
HttpRequest(ServletService server,
SocketLink conn)
Creates a new HttpRequest.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkLogin() |
HttpResponse |
createResponse() |
protected java.lang.String |
dbgId() |
protected void |
extendHeaderBuffers() |
java.lang.String |
findSessionIdFromConnection()
For SSL connections, use the SSL identifier.
|
void |
finishRequest()
Cleans up at the end of the invocation
|
java.lang.String |
getHeader(java.lang.String key)
Returns the header.
|
CharSegment |
getHeaderBuffer(char[] testBuf,
int length)
Returns the matching header.
|
CharSegment |
getHeaderBuffer(java.lang.String key)
Returns the header value for the key, returned as a CharSegment.
|
void |
getHeaderBuffers(java.lang.String key,
java.util.ArrayList<CharSegment> values)
Fills an ArrayList with the header values matching the key.
|
CharSegment |
getHeaderKey(int index)
Returns the header key
|
java.util.Enumeration<java.lang.String> |
getHeaderNames()
Returns an enumeration of all the header keys.
|
java.util.Enumeration<java.lang.String> |
getHeaders(java.lang.String key)
Return an enumeration of headers matching a key.
|
int |
getHeaderSize()
Returns the number of headers.
|
CharSegment |
getHeaderValue(int index)
Returns the header value
|
protected java.lang.CharSequence |
getHost()
Returns the virtual host of the request
|
java.lang.String |
getMethod()
Returns the HTTP method (GET, POST, HEAD, etc.)
|
CharSegment |
getMethodBuffer()
Returns a buffer containing the request method.
|
java.lang.String |
getProtocol()
Returns the protocol.
|
CharSegment |
getProtocolBuffer()
Returns a char segment containing the protocol.
|
ReadStream |
getRawInput()
Returns the raw input stream.
|
byte[] |
getUriBuffer()
Returns the byte buffer containing the request URI
|
int |
getUriLength()
Returns the length of the request URI
|
boolean |
handleRequest()
Handles a new HTTP request.
|
boolean |
hasRequest()
Returns true if the request exists
|
protected void |
initAttributes(HttpServletRequestImpl request)
Initialize any special attributes.
|
boolean |
initStream(ReadStream readStream,
ReadStream rawRead)
Returns a stream for reading POST data.
|
boolean |
isTop()
Returns true for the top-level request, but false for any include()
or forward()
|
boolean |
isWaitForRead()
Return true if the request waits for a read before beginning.
|
void |
onCloseConnection()
Handles a close event when the connection is closed.
|
void |
setHeader(java.lang.String key,
java.lang.String value)
Adds a new header.
|
protected void |
skip() |
SocketLinkDuplexController |
startDuplex(SocketLinkDuplexListener handler)
Upgrade to duplex
|
protected void |
startRequest()
Clear the request variables in preparation for a new request.
|
java.lang.String |
toString() |
addHeaderInt, allocateHttpBufferStore, buildInvocation, cleanup, clearRequest, clientDisconnect, finishInvocation, getAbstractHttpResponse, getAvailable, getBufferAvailable, getCharacterEncoding, getCharBuffer, getConnection, getConnectionId, getContentLength, getContentType, getContentTypeBuffer, getCookies, getDateHeader, getErrorManager, getForm, getFormParser, getForwardedHostHeader, getHostHeader, getHttpBufferStore, getInputStream, getIntHeader, getInvocation, getInvocationServer, getLocale, getLocales, getLocalHost, getLocalPort, getLongContentLength, getProtocolRequestURL, getRawRead, getRawReadBuffer, getRawWrite, getReader, getReadStream, getRemoteAddr, getRemoteHost, getRemotePort, getRequestFacade, getRequestURI, getRequestURL, getResponse, getResponseFacade, getScheme, getServer, getServerName, getServerPort, getSmallHeaderBuffer, getSmallHeaderKeys, getSmallHeaderValues, getSmallUriBuffer, getStartTime, getStream, getStream, getTcpSocketLink, getUserPrincipal, getWebApp, handleConnectionClose, handleResume, init, isCometActive, isConnectionClosed, isDuplex, isIgnoreClientDisconnect, isKeepalive, isSecure, isSuspend, isTransportSecure, isUserInRole, killKeepalive, onAttachThread, onDetachThread, onStartConnection, printRemoteAddr, restartServer, runAs, sendRequestError, setCharacterEncoding, setContentLength, shutdown, startInvocation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProtocolRequestURL, handleResume, init, onAttachThread, onDetachThread, onStartConnection
public static final int HTTP_0_9
public static final int HTTP_1_0
public static final int HTTP_1_1
public HttpRequest(ServletService server, SocketLink conn)
server
- the owning server.public HttpResponse createResponse()
createResponse
in class AbstractHttpRequest
public final boolean isWaitForRead()
isWaitForRead
in interface ProtocolConnection
public boolean hasRequest()
hasRequest
in class AbstractHttpRequest
public boolean isTop()
protected boolean checkLogin()
public CharSegment getMethodBuffer()
public java.lang.String getMethod()
getMethod
in class AbstractHttpRequest
protected java.lang.CharSequence getHost()
getHost
in class AbstractHttpRequest
public byte[] getUriBuffer()
getUriBuffer
in class AbstractHttpRequest
public int getUriLength()
getUriLength
in class AbstractHttpRequest
public java.lang.String getProtocol()
getProtocol
in class AbstractHttpRequest
public CharSegment getProtocolBuffer()
public java.lang.String getHeader(java.lang.String key)
getHeader
in class AbstractHttpRequest
key
- the header keypublic int getHeaderSize()
getHeaderSize
in class AbstractHttpRequest
public CharSegment getHeaderKey(int index)
getHeaderKey
in class AbstractHttpRequest
public CharSegment getHeaderValue(int index)
getHeaderValue
in class AbstractHttpRequest
public CharSegment getHeaderBuffer(char[] testBuf, int length)
testBuf
- header keylength
- length of the key.public CharSegment getHeaderBuffer(java.lang.String key)
getHeaderBuffer
in class AbstractHttpRequest
key
- the header namepublic void getHeaderBuffers(java.lang.String key, java.util.ArrayList<CharSegment> values)
getHeaderBuffers
in class AbstractHttpRequest
values
- ArrayList which will contain the maching values.key
- the header key to select.public java.util.Enumeration<java.lang.String> getHeaders(java.lang.String key)
getHeaders
in class AbstractHttpRequest
key
- the header key to match.public java.util.Enumeration<java.lang.String> getHeaderNames()
getHeaderNames
in class AbstractHttpRequest
public void setHeader(java.lang.String key, java.lang.String value)
setHeader
in class AbstractHttpRequest
key
- the key of the new headervalue
- the value for the new headerprotected void initAttributes(HttpServletRequestImpl request)
initAttributes
in class AbstractHttpRequest
public java.lang.String findSessionIdFromConnection()
findSessionIdFromConnection
in class AbstractHttpRequest
public boolean initStream(ReadStream readStream, ReadStream rawRead) throws java.io.IOException
initStream
in class AbstractHttpRequest
java.io.IOException
protected void skip() throws java.io.IOException
skip
in class AbstractHttpRequest
java.io.IOException
public ReadStream getRawInput()
getRawInput
in class AbstractHttpRequest
public boolean handleRequest() throws java.io.IOException
Note: ClientDisconnectException must be rethrown to the caller.
handleRequest
in interface ProtocolConnection
handleRequest
in class AbstractProtocolConnection
java.io.IOException
protected void startRequest() throws java.io.IOException
startRequest
in class AbstractHttpRequest
s
- the read stream for the requestjava.io.IOException
protected void extendHeaderBuffers() throws java.io.IOException
java.io.IOException
public void onCloseConnection()
AbstractProtocolConnection
onCloseConnection
in interface ProtocolConnection
onCloseConnection
in class AbstractHttpRequest
public SocketLinkDuplexController startDuplex(SocketLinkDuplexListener handler)
startDuplex
in class AbstractHttpRequest
public void finishRequest() throws java.io.IOException
finishRequest
in class AbstractHttpRequest
java.io.IOException
protected java.lang.String dbgId()
dbgId
in class AbstractHttpRequest
public java.lang.String toString()
toString
in class java.lang.Object