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, startInvocationclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetProtocolRequestURL, handleResume, init, onAttachThread, onDetachThread, onStartConnectionpublic 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 AbstractHttpRequestpublic final boolean isWaitForRead()
isWaitForRead in interface ProtocolConnectionpublic boolean hasRequest()
hasRequest in class AbstractHttpRequestpublic boolean isTop()
protected boolean checkLogin()
public CharSegment getMethodBuffer()
public java.lang.String getMethod()
getMethod in class AbstractHttpRequestprotected java.lang.CharSequence getHost()
getHost in class AbstractHttpRequestpublic byte[] getUriBuffer()
getUriBuffer in class AbstractHttpRequestpublic int getUriLength()
getUriLength in class AbstractHttpRequestpublic java.lang.String getProtocol()
getProtocol in class AbstractHttpRequestpublic CharSegment getProtocolBuffer()
public java.lang.String getHeader(java.lang.String key)
getHeader in class AbstractHttpRequestkey - the header keypublic int getHeaderSize()
getHeaderSize in class AbstractHttpRequestpublic CharSegment getHeaderKey(int index)
getHeaderKey in class AbstractHttpRequestpublic CharSegment getHeaderValue(int index)
getHeaderValue in class AbstractHttpRequestpublic CharSegment getHeaderBuffer(char[] testBuf, int length)
testBuf - header keylength - length of the key.public CharSegment getHeaderBuffer(java.lang.String key)
getHeaderBuffer in class AbstractHttpRequestkey - the header namepublic void getHeaderBuffers(java.lang.String key,
java.util.ArrayList<CharSegment> values)
getHeaderBuffers in class AbstractHttpRequestvalues - 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 AbstractHttpRequestkey - the header key to match.public java.util.Enumeration<java.lang.String> getHeaderNames()
getHeaderNames in class AbstractHttpRequestpublic void setHeader(java.lang.String key,
java.lang.String value)
setHeader in class AbstractHttpRequestkey - the key of the new headervalue - the value for the new headerprotected void initAttributes(HttpServletRequestImpl request)
initAttributes in class AbstractHttpRequestpublic java.lang.String findSessionIdFromConnection()
findSessionIdFromConnection in class AbstractHttpRequestpublic boolean initStream(ReadStream readStream, ReadStream rawRead) throws java.io.IOException
initStream in class AbstractHttpRequestjava.io.IOExceptionprotected void skip()
throws java.io.IOException
skip in class AbstractHttpRequestjava.io.IOExceptionpublic ReadStream getRawInput()
getRawInput in class AbstractHttpRequestpublic boolean handleRequest()
throws java.io.IOException
Note: ClientDisconnectException must be rethrown to the caller.
handleRequest in interface ProtocolConnectionhandleRequest in class AbstractProtocolConnectionjava.io.IOExceptionprotected void startRequest()
throws java.io.IOException
startRequest in class AbstractHttpRequests - the read stream for the requestjava.io.IOExceptionprotected void extendHeaderBuffers()
throws java.io.IOException
java.io.IOExceptionpublic void onCloseConnection()
AbstractProtocolConnectiononCloseConnection in interface ProtocolConnectiononCloseConnection in class AbstractHttpRequestpublic SocketLinkDuplexController startDuplex(SocketLinkDuplexListener handler)
startDuplex in class AbstractHttpRequestpublic void finishRequest()
throws java.io.IOException
finishRequest in class AbstractHttpRequestjava.io.IOExceptionprotected java.lang.String dbgId()
dbgId in class AbstractHttpRequestpublic java.lang.String toString()
toString in class java.lang.Object