|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.http.AbstractHttpRequest
public abstract class AbstractHttpRequest
Abstract request implementing methods common to the different request implementations.
| Field Summary | |
|---|---|
protected static CaseInsensitiveIntMap |
_headerCodes
|
protected CharSegment |
_hostHeader
|
static java.lang.String |
JSP_EXCEPTION
|
static java.lang.String |
SHUTDOWN
|
| Constructor Summary | |
|---|---|
protected |
AbstractHttpRequest(Server server,
SocketLink conn)
Create a new Request. |
| Method Summary | |
|---|---|
protected boolean |
addHeaderInt(char[] keyBuf,
int keyOff,
int keyLen,
CharSegment value)
Adds the header, checking for known values. |
protected Invocation |
buildInvocation(Invocation invocation,
byte[] uri,
int uriLength)
|
void |
cleanup()
|
protected void |
clearRequest()
|
void |
clientDisconnect()
Sets the client disconnect |
protected abstract AbstractHttpResponse |
createResponse()
|
protected java.lang.String |
dbgId()
|
java.lang.String |
findSessionIdFromConnection()
For SSL connections, use the SSL identifier. |
void |
finishInvocation()
Cleans up at the end of the invocation |
void |
finishRequest()
Cleans up at the end of the request |
protected AbstractHttpResponse |
getAbstractHttpResponse()
|
int |
getAvailable()
|
java.lang.String |
getCharacterEncoding()
Returns the character encoding of a post. |
protected CharBuffer |
getCharBuffer()
|
SocketLink |
getConnection()
Returns the connection. |
int |
getConnectionId()
|
int |
getContentLength()
Returns the content length of a post. |
java.lang.String |
getContentType()
Returns the content-length of a post. |
CharSegment |
getContentTypeBuffer()
Returns the content-length of a post. |
Cookie[] |
getCookies()
Returns the cookies from the browser |
long |
getDateHeader(java.lang.String key)
Returns a header interpreted as a date. |
protected ErrorPageManager |
getErrorManager()
Returns the default error manager |
protected HashMapImpl<java.lang.String,java.lang.String[]> |
getForm()
|
protected Form |
getFormParser()
|
abstract java.lang.String |
getHeader(java.lang.String key)
Returns the named header. |
CharSegment |
getHeaderBuffer(java.lang.String name)
Fills the result with the header values as CharSegment values. |
void |
getHeaderBuffers(java.lang.String name,
java.util.ArrayList<CharSegment> resultList)
Fills the result with a list of the header values as CharSegment values. |
CharSegment |
getHeaderKey(int index)
Returns the header key |
abstract java.util.Enumeration<java.lang.String> |
getHeaderNames()
Enumerates the header keys |
java.util.Enumeration<java.lang.String> |
getHeaders(java.lang.String name)
Returns an enumeration of the headers for the named attribute. |
int |
getHeaderSize()
Returns the number of headers. |
CharSegment |
getHeaderValue(int index)
Returns the header value |
protected java.lang.CharSequence |
getHost()
|
ServletInputStream |
getInputStream()
Returns a stream for reading POST data. |
int |
getIntHeader(java.lang.String key)
Returns the named header, converted to an integer. |
protected Invocation |
getInvocation(java.lang.CharSequence host,
byte[] uri,
int uriLength)
|
InvocationServer |
getInvocationServer()
returns the dispatch server. |
java.util.Locale |
getLocale()
|
java.util.Enumeration<java.util.Locale> |
getLocales()
|
java.lang.String |
getLocalHost()
Returns the server's address. |
int |
getLocalPort()
Returns the local port. |
byte[] |
getLogBuffer()
Returns the log buffer. |
long |
getLongContentLength()
Returns the content length of a post. |
abstract java.lang.String |
getMethod()
|
abstract java.lang.String |
getProtocol()
|
java.lang.String |
getProtocolRequestURL()
Returns a request URL for debugging/management. |
ReadStream |
getRawInput()
Returns the raw input stream. |
ReadStream |
getRawRead()
|
byte[] |
getRawReadBuffer()
Returns the raw read buffer. |
WriteStream |
getRawWrite()
|
java.io.BufferedReader |
getReader()
Returns a Reader for the POST contents |
ReadStream |
getReadStream()
|
java.lang.String |
getRemoteAddr()
|
java.lang.String |
getRemoteHost()
|
int |
getRemotePort()
Returns the local port. |
HttpServletRequestImpl |
getRequestFacade()
|
java.lang.String |
getRequestURI()
|
java.lang.StringBuffer |
getRequestURL()
|
AbstractHttpResponse |
getResponse()
Returns the response for this request. |
HttpServletResponseImpl |
getResponseFacade()
|
java.lang.String |
getScheme()
Returns the request's scheme. |
Server |
getServer()
|
java.lang.String |
getServerName()
Returns the local server name. |
int |
getServerPort()
Returns the server's port. |
long |
getStartTime()
Returns the date for the current request. |
ReadStream |
getStream()
Returns the requests underlying read stream, e.g. |
ReadStream |
getStream(boolean isReader)
Returns the requests underlying read stream, e.g. |
abstract byte[] |
getUriBuffer()
|
abstract int |
getUriLength()
|
java.security.Principal |
getUserPrincipal()
Returns the Principal for the context. |
protected WebApp |
getWebApp()
|
protected void |
handleConnectionClose()
Called for a connection: close |
boolean |
handleResume()
Handles a comet-style resume. |
boolean |
hasRequest()
Returns true if a request has been set |
void |
init()
Initialization. |
protected void |
initAttributes(HttpServletRequestImpl facade)
|
protected abstract boolean |
initStream(ReadStream readStream,
ReadStream rawStream)
Initialize the read stream from the raw stream. |
boolean |
isCometActive()
|
boolean |
isConnectionClosed()
Returns true if the client has disconnected |
boolean |
isDuplex()
|
boolean |
isIgnoreClientDisconnect()
Returns true if client disconnects should be ignored. |
protected boolean |
isKeepalive()
Returns true if the keepalive is active. |
boolean |
isSecure()
Returns true if the request is secure. |
boolean |
isSuspend()
|
boolean |
isTransportSecure()
Returns true if the transport is secure. |
boolean |
isUserInRole(java.lang.String role)
Returns true if the user principal plays the named role. |
void |
killKeepalive(java.lang.String reason)
Kills the keepalive. |
void |
onCloseConnection()
Handles a close event when the connection is closed. |
void |
onStartConnection()
Called when the connection starts |
int |
printRemoteAddr(byte[] buffer,
int offset)
|
protected void |
restartServer()
Restarts the server. |
java.lang.String |
runAs(java.lang.String string)
Sets the current runAs role/principal. |
protected void |
sendRequestError(java.lang.Throwable e)
|
void |
setCharacterEncoding(java.lang.String encoding)
Sets the character encoding of a post. |
protected void |
setContentLength(CharSegment value)
|
void |
setHeader(java.lang.String key,
java.lang.String value)
Sets the header. |
void |
shutdown()
Called by server shutdown to kill any active threads |
protected void |
skip()
|
SocketLinkDuplexController |
startDuplex(SocketLinkDuplexListener handler)
Starts duplex mode. |
protected void |
startInvocation()
Prepare the Request object for a new request. |
protected void |
startRequest(HttpBufferStore httpBuffer)
Prepare the Request object for a new request. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.caucho.network.listen.ProtocolConnection |
|---|
handleRequest, isWaitForRead |
| Field Detail |
|---|
protected static final CaseInsensitiveIntMap _headerCodes
public static final java.lang.String JSP_EXCEPTION
public static final java.lang.String SHUTDOWN
protected CharSegment _hostHeader
| Constructor Detail |
|---|
protected AbstractHttpRequest(Server server,
SocketLink conn)
server - the parent server| Method Detail |
|---|
public Server getServer()
protected abstract AbstractHttpResponse createResponse()
protected AbstractHttpResponse getAbstractHttpResponse()
public void init()
init in interface ProtocolConnectionpublic final SocketLink getConnection()
public final int getConnectionId()
public final InvocationServer getInvocationServer()
protected final CharBuffer getCharBuffer()
public void onStartConnection()
onStartConnection in interface ProtocolConnection
protected void startRequest(HttpBufferStore httpBuffer)
throws java.io.IOException
httpBuffer - the raw connection stream
java.io.IOExceptionprotected void clearRequest()
public boolean hasRequest()
public WriteStream getRawWrite()
public abstract byte[] getUriBuffer()
public abstract int getUriLength()
public boolean isIgnoreClientDisconnect()
protected WebApp getWebApp()
public java.lang.StringBuffer getRequestURL()
public java.lang.String getRequestURI()
public java.lang.String getProtocolRequestURL()
ProtocolConnection
getProtocolRequestURL in interface ProtocolConnectionpublic boolean isConnectionClosed()
public void clientDisconnect()
public final HttpServletRequestImpl getRequestFacade()
public final HttpServletResponseImpl getResponseFacade()
public AbstractHttpResponse getResponse()
public java.lang.String getServerName()
protected java.lang.CharSequence getHost()
public int getServerPort()
public int getLocalPort()
public java.lang.String getLocalHost()
public java.lang.String getRemoteAddr()
public int printRemoteAddr(byte[] buffer,
int offset)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getRemoteHost()
public int getRemotePort()
public java.lang.String getScheme()
public abstract java.lang.String getProtocol()
public abstract java.lang.String getMethod()
public abstract java.lang.String getHeader(java.lang.String key)
key - the header keypublic int getHeaderSize()
public CharSegment getHeaderKey(int index)
public CharSegment getHeaderValue(int index)
public CharSegment getHeaderBuffer(java.lang.String name)
name - the header namepublic abstract java.util.Enumeration<java.lang.String> getHeaderNames()
public void setHeader(java.lang.String key,
java.lang.String value)
protected boolean addHeaderInt(char[] keyBuf,
int keyOff,
int keyLen,
CharSegment value)
protected void setContentLength(CharSegment value)
protected void handleConnectionClose()
public java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
name - the header name
public void getHeaderBuffers(java.lang.String name,
java.util.ArrayList<CharSegment> resultList)
name - the header nameresultList - the resulting bufferpublic int getIntHeader(java.lang.String key)
key - the header key.
public long getDateHeader(java.lang.String key)
key - the header key.
public int getContentLength()
public long getLongContentLength()
public java.lang.String getContentType()
public CharSegment getContentTypeBuffer()
public java.lang.String getCharacterEncoding()
public void setCharacterEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic Cookie[] getCookies()
public java.lang.String findSessionIdFromConnection()
public boolean isTransportSecure()
isTransportSecure in interface SecurityContextProvider
public ReadStream getStream()
throws java.io.IOException
java.io.IOException
public ReadStream getStream(boolean isReader)
throws java.io.IOException
java.io.IOExceptionpublic final ReadStream getRawRead()
public final ReadStream getReadStream()
public byte[] getRawReadBuffer()
public int getAvailable()
throws java.io.IOException
java.io.IOException
protected void skip()
throws java.io.IOException
java.io.IOException
protected abstract boolean initStream(ReadStream readStream,
ReadStream rawStream)
throws java.io.IOException
java.io.IOExceptionpublic ReadStream getRawInput()
public final ServletInputStream getInputStream()
throws java.io.IOException
java.io.IOException
public final java.io.BufferedReader getReader()
throws java.io.IOException
java.io.IOExceptionprotected void initAttributes(HttpServletRequestImpl facade)
public java.util.Locale getLocale()
public java.util.Enumeration<java.util.Locale> getLocales()
public boolean isSecure()
public java.lang.String runAs(java.lang.String string)
SecurityContextProviderisUserInRole and getUserPrincipal.
runAs in interface SecurityContextProviderstring - the new role
public boolean isUserInRole(java.lang.String role)
SecurityContextProvider
isUserInRole in interface SecurityContextProviderrole - the permission to test against.public java.security.Principal getUserPrincipal()
SecurityContextProvider
getUserPrincipal in interface SecurityContextProviderpublic final long getStartTime()
public final byte[] getLogBuffer()
protected Invocation getInvocation(java.lang.CharSequence host,
byte[] uri,
int uriLength)
throws java.io.IOException
java.io.IOException
protected Invocation buildInvocation(Invocation invocation,
byte[] uri,
int uriLength)
throws java.io.IOException
java.io.IOException
public boolean handleResume()
throws java.io.IOException
handleResume in interface ProtocolConnectionjava.io.IOExceptionpublic SocketLinkDuplexController startDuplex(SocketLinkDuplexListener handler)
protected void sendRequestError(java.lang.Throwable e)
throws java.io.IOException
java.io.IOExceptionprotected ErrorPageManager getErrorManager()
public void killKeepalive(java.lang.String reason)
protected boolean isKeepalive()
public boolean isCometActive()
public boolean isSuspend()
public boolean isDuplex()
protected HashMapImpl<java.lang.String,java.lang.String[]> getForm()
protected Form getFormParser()
protected void restartServer()
protected void startInvocation()
throws java.io.IOException
java.io.IOExceptionpublic void finishInvocation()
public void finishRequest()
throws java.io.IOException
java.io.IOExceptionpublic void onCloseConnection()
ProtocolConnection
onCloseConnection in interface ProtocolConnectionpublic void cleanup()
public void shutdown()
protected java.lang.String dbgId()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||