|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.connection.AbstractHttpRequest
public abstract class AbstractHttpRequest
Abstract request implementing methods common to the different request implementations.
| Field Summary | |
|---|---|
protected QDate |
_calendar
|
protected CharBuffer |
_cb
|
protected Connection |
_conn
|
protected boolean |
_expect100Continue
|
protected boolean |
_hasReadStream
|
protected static CaseInsensitiveIntMap |
_headerCodes
|
protected CharSegment |
_hostHeader
|
protected Invocation |
_invocation
|
protected ReadStream |
_rawRead
|
protected ReadStream |
_readStream
|
protected AbstractHttpResponse |
_response
|
protected DispatchServer |
_server
|
protected int |
_sessionGroup
|
protected TcpConnection |
_tcpConn
|
static java.lang.String |
CONTEXT_PATH
|
static java.lang.String |
ERROR_URI
|
static java.lang.String |
EXCEPTION
|
static java.lang.String |
EXCEPTION_TYPE
|
static java.lang.String |
JSP_EXCEPTION
|
protected static java.util.logging.Logger |
log
|
static java.lang.String |
MESSAGE
|
static java.lang.String |
PATH_INFO
|
static java.lang.String |
QUERY_STRING
|
static java.lang.String |
REQUEST_URI
|
static java.lang.String |
SERVLET_NAME
|
static java.lang.String |
SERVLET_PATH
|
static java.lang.String |
SHUTDOWN
|
static java.lang.String |
STATUS_CODE
|
| Fields inherited from interface javax.servlet.http.HttpServletRequest |
|---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Constructor Summary | |
|---|---|
protected |
AbstractHttpRequest(DispatchServer server,
Connection conn)
Create a new Request. |
| Method Summary | |
|---|---|
void |
addCloseOnExit(Path path)
Adds a file to be removed at the end. |
protected boolean |
addHeaderInt(char[] keyBuf,
int keyOff,
int keyLen,
CharSegment value)
Adds the header, checking for known values. |
boolean |
allowKeepalive()
Returns true if keepalives are allowed. |
boolean |
authenticate()
Authenticate the user. |
void |
cleanup()
|
protected void |
connectionClose()
Called for a connection: close |
protected java.lang.String |
dbgId()
|
java.lang.String |
findSessionIdFromConnection()
For SSL connections, use the SSL identifier. |
void |
finish()
Cleans up at the end of the request |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named request attribute. |
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Returns an enumeration of the request attribute names. |
java.lang.String |
getAuthType()
Gets the authorization type |
java.lang.String |
getCharacterEncoding()
Returns the character encoding of a post. |
Connection |
getConnection()
Returns the connection. |
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. |
java.lang.String |
getContextPath()
Returns the context part of the uri. |
Cookie |
getCookie(java.lang.String name)
Returns the named cookie from the browser |
Cookie[] |
getCookies()
Returns the cookies from the browser |
long |
getDateHeader(java.lang.String key)
Returns a header interpreted as a date. |
DispatchServer |
getDispatchServer()
returns the dispatch server. |
boolean |
getHasCookie()
True if this page uses cookies. |
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 |
getHeaderNames()
Enumerates the header keys |
java.util.Enumeration |
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. |
Invocation |
getInvocation()
Returns the request's invocation. |
HttpSession |
getLoadedSession()
Returns the current session. |
java.lang.String |
getLocalAddr()
Returns the server's address. |
java.util.Locale |
getLocale()
Returns the request's preferred locale, based on the Accept-Language header. |
java.util.Enumeration<java.util.Locale> |
getLocales()
Returns an enumeration of all locales acceptable by the client. |
java.lang.String |
getLocalName()
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. |
HttpSession |
getMemorySession()
Returns the memory session. |
abstract java.lang.String |
getMethod()
Returns the HTTP method, e.g. |
java.lang.String |
getPageContextPath()
Returns the context part of the uri. |
java.lang.String |
getPagePathInfo()
Returns the portion of the uri after the servlet path for the current page. |
java.lang.String |
getPageQueryString()
Returns the current page's query string. |
java.lang.String |
getPageServletPath()
Returns the portion of the uri mapped to the servlet for the current page. |
java.lang.String |
getPageURI()
Returns the URI for the page. |
java.lang.String |
getParameter(java.lang.String name)
Returns the form primary value for the given name. |
java.util.Map<java.lang.String,java.lang.String[]> |
getParameterMap()
Returns a map of the form. |
java.util.Enumeration<java.lang.String> |
getParameterNames()
Returns an enumeration of the form names. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns the form's values for the given name. |
java.lang.String |
getPathInfo()
Returns the portion of the uri after the servlet path for the original request. |
java.lang.String |
getPathTranslated()
Returns the real path of pathInfo. |
abstract java.lang.String |
getProtocol()
Returns the prococol, e.g. |
java.lang.String |
getQueryString()
Returns the current page's query string. |
ReadStream |
getRawInput()
Returns the raw input stream. |
byte[] |
getRawReadBuffer()
Returns the raw read buffer. |
java.io.BufferedReader |
getReader()
Returns a Reader for the POST contents |
java.lang.String |
getRealPath(java.lang.String path)
Deprecated. As of JSDK 2.1 |
java.lang.String |
getRemoteAddr()
Returns the IP address of the remote host, i.e. |
java.lang.String |
getRemoteHost()
Returns the DNS hostname of the remote host, i.e. |
int |
getRemotePort()
Returns the local port. |
java.lang.String |
getRemoteUser()
Gets the remote user from the authorization type |
java.lang.String |
getRemoteUser(boolean create)
Internal logging return to get the remote user. |
int |
getRequestDepth()
|
int |
getRequestDepth(int depth)
Returns the depth of the request calls. |
RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Returns a request dispatcher relative to the current request. |
java.lang.String |
getRequestedSessionId()
Returns the session id in the HTTP request. |
java.lang.String |
getRequestedSessionIdNoVary()
Returns the session id in the HTTP request. |
java.lang.String |
getRequestURI()
Returns the URI for the request |
java.lang.StringBuffer |
getRequestURL()
Returns the URL for the request |
CauchoResponse |
getResponse()
Returns the response for this request. |
java.lang.String |
getScheme()
Returns the request's scheme. |
java.lang.String |
getServerName()
Returns the local server name. |
int |
getServerPort()
Returns the server's port. |
java.lang.String |
getServletName()
Returns the servlet name. |
java.lang.String |
getServletPath()
Returns the portion of the uri mapped to the servlet for the original request. |
HttpSession |
getSession()
Returns the current session, creating one if necessary. |
HttpSession |
getSession(boolean create)
Returns the current session. |
protected java.lang.String |
getSessionCookie(SessionManager manager)
Returns the session cookie. |
int |
getSessionGroup()
|
protected SessionManager |
getSessionManager()
Returns the session manager. |
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 representing the logged in user. |
java.lang.String |
getVaryCookie()
Returns the cookie the page depends on, or null if the page depends on several cookies. |
boolean |
getVaryCookies()
Returns true if the page depends on cookies. |
WebApp |
getWebApp()
Returns the invocation's webApp. |
boolean |
handleResume()
Handles a comet-style resume. |
void |
init()
Initialization. |
protected abstract boolean |
initStream(ReadStream readStream,
ReadStream rawStream)
Initialize the read stream from the raw stream. |
boolean |
isIgnoreClientDisconnect()
Returns true if client disconnects should be ignored. |
protected boolean |
isKeepalive()
Returns true if the keepalive is active. |
boolean |
isRequestedSessionIdFromCookie()
Returns true if the current sessionId came from a cookie. |
boolean |
isRequestedSessionIdFromUrl()
Deprecated. |
boolean |
isRequestedSessionIdFromURL()
Returns true if the current sessionId came from the url. |
boolean |
isRequestedSessionIdValid()
Returns true if the HTTP request's session id refers to a valid session. |
boolean |
isSecure()
Returns true if the request is secure. |
boolean |
isTop()
Returns true for the top-level request, but false for any include() or forward() |
boolean |
isTransportSecure()
Returns true if the transport is secure. |
boolean |
isUserInRole(java.lang.String role)
Returns true if the user represented by the current request plays the named role. |
void |
killKeepalive()
Kills the keepalive. |
void |
logout()
Logs out the principal. |
void |
logoutUserPrincipal()
Clear the principal from the request object. |
int |
printRemoteAddr(byte[] buffer,
int offset)
|
void |
removeAttribute(java.lang.String name)
Removes the value of the named request attribute. |
protected void |
restartServer()
Restarts the server. |
protected void |
resume()
Prepare the Request object for a new request. |
java.lang.String |
runAs(java.lang.String role)
Sets the overriding role. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the value of the named request attribute. |
void |
setCharacterEncoding(java.lang.String encoding)
Sets the character encoding of a post. |
void |
setHasCookie()
Set when the page actually has a cookie. |
void |
setHeader(java.lang.String key,
java.lang.String value)
Sets the header. |
void |
setInvocation(Invocation invocation)
Sets the request's invocation. |
protected void |
setStartTime()
Sets the start time to the current time. |
void |
setVaryCookie(java.lang.String cookie)
Called if the page depends on a cookie. |
protected void |
skip()
|
protected void |
start()
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 |
| Field Detail |
|---|
protected static final java.util.logging.Logger log
protected static final CaseInsensitiveIntMap _headerCodes
public static final java.lang.String REQUEST_URI
public static final java.lang.String CONTEXT_PATH
public static final java.lang.String SERVLET_PATH
public static final java.lang.String PATH_INFO
public static final java.lang.String QUERY_STRING
public static final java.lang.String STATUS_CODE
public static final java.lang.String EXCEPTION_TYPE
public static final java.lang.String MESSAGE
public static final java.lang.String EXCEPTION
public static final java.lang.String ERROR_URI
public static final java.lang.String SERVLET_NAME
public static final java.lang.String JSP_EXCEPTION
public static final java.lang.String SHUTDOWN
protected final DispatchServer _server
protected final Connection _conn
protected final TcpConnection _tcpConn
protected AbstractHttpResponse _response
protected Invocation _invocation
protected CharSegment _hostHeader
protected boolean _expect100Continue
protected int _sessionGroup
protected final ReadStream _rawRead
protected final ReadStream _readStream
protected boolean _hasReadStream
protected final QDate _calendar
protected final CharBuffer _cb
| Constructor Detail |
|---|
protected AbstractHttpRequest(DispatchServer server,
Connection conn)
server - the parent server| Method Detail |
|---|
public void init()
public final Connection getConnection()
public final DispatchServer getDispatchServer()
protected void start()
throws java.io.IOException
s - the raw connection stream
java.io.IOException
protected void resume()
throws java.io.IOException
s - the raw connection stream
java.io.IOExceptionpublic boolean isIgnoreClientDisconnect()
public CauchoResponse getResponse()
public java.lang.String getServerName()
getServerName in interface ServletRequestprotected java.lang.CharSequence getHost()
public int getServerPort()
getServerPort in interface ServletRequestpublic int getLocalPort()
getLocalPort in interface ServletRequestpublic java.lang.String getLocalAddr()
getLocalAddr in interface ServletRequestpublic java.lang.String getLocalName()
getLocalName in interface ServletRequestpublic java.lang.String getRemoteAddr()
ServletRequest
getRemoteAddr in interface ServletRequest
public int printRemoteAddr(byte[] buffer,
int offset)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getRemoteHost()
ServletRequest
getRemoteHost in interface ServletRequestpublic int getRemotePort()
getRemotePort in interface ServletRequestpublic java.lang.String getScheme()
getScheme in interface ServletRequestpublic abstract java.lang.String getProtocol()
ServletRequest
getProtocol in interface ServletRequestpublic abstract java.lang.String getMethod()
HttpServletRequestREQUEST_METHOD
getMethod in interface HttpServletRequestpublic java.lang.String getRequestURI()
getRequestURI in interface HttpServletRequestpublic java.lang.String getPageURI()
getPageURI in interface CauchoRequestpublic abstract byte[] getUriBuffer()
public abstract int getUriLength()
public java.lang.String getContextPath()
getContextPath in interface HttpServletRequestpublic java.lang.String getPageContextPath()
getPageContextPath in interface CauchoRequestpublic java.lang.String getServletPath()
getServletPath in interface HttpServletRequestpublic java.lang.String getPageServletPath()
getPageServletPath in interface CauchoRequestpublic java.lang.String getPathInfo()
getPathInfo in interface HttpServletRequestpublic java.lang.String getPagePathInfo()
getPagePathInfo in interface CauchoRequestpublic java.lang.StringBuffer getRequestURL()
getRequestURL in interface HttpServletRequestpublic java.lang.String getRealPath(java.lang.String path)
ServletRequest
getRealPath in interface ServletRequestpublic java.lang.String getPathTranslated()
getPathTranslated in interface HttpServletRequestpublic java.lang.String getQueryString()
getQueryString in interface HttpServletRequestpublic java.lang.String getPageQueryString()
getPageQueryString in interface CauchoRequestpublic abstract java.lang.String getHeader(java.lang.String key)
getHeader in interface HttpServletRequestkey - the header key
public 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 getHeaderNames()
getHeaderNames in interface HttpServletRequest
public void setHeader(java.lang.String key,
java.lang.String value)
setHeader in interface CauchoRequest
protected boolean addHeaderInt(char[] keyBuf,
int keyOff,
int keyLen,
CharSegment value)
protected void connectionClose()
public java.util.Enumeration getHeaders(java.lang.String name)
getHeaders in interface HttpServletRequestname - 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)
getIntHeader in interface HttpServletRequestkey - the header key.
public long getDateHeader(java.lang.String key)
getDateHeader in interface HttpServletRequestkey - the header key.
public int getContentLength()
getContentLength in interface ServletRequestpublic long getLongContentLength()
public java.lang.String getContentType()
getContentType in interface ServletRequestpublic CharSegment getContentTypeBuffer()
public java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ServletRequest
public void setCharacterEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface ServletRequestjava.io.UnsupportedEncodingExceptionpublic Cookie[] getCookies()
getCookies in interface HttpServletRequestpublic Cookie getCookie(java.lang.String name)
getCookie in interface CauchoRequestpublic void setVaryCookie(java.lang.String cookie)
setVaryCookie in interface CauchoRequestcookie - the cookie the page depends on.public boolean getVaryCookies()
getVaryCookies in interface CauchoRequestpublic java.lang.String getVaryCookie()
getVaryCookie in interface CauchoRequestpublic void setHasCookie()
setHasCookie in interface CauchoRequestpublic boolean getHasCookie()
getHasCookie in interface CauchoRequestpublic HttpSession getMemorySession()
getMemorySession in interface CauchoRequestpublic HttpSession getSession()
getSession in interface HttpServletRequestpublic HttpSession getSession(boolean create)
getSession in interface HttpServletRequestcreate - true if a new session should be created
public HttpSession getLoadedSession()
create - true if a new session should be created
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface HttpServletRequestpublic boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface HttpServletRequestpublic java.lang.String getRequestedSessionIdNoVary()
public java.lang.String getRequestedSessionId()
getRequestedSessionId in interface HttpServletRequestpublic java.lang.String findSessionIdFromConnection()
public int getSessionGroup()
protected final SessionManager getSessionManager()
protected final java.lang.String getSessionCookie(SessionManager manager)
public java.lang.String getAuthType()
getAuthType in interface HttpServletRequestpublic java.lang.String getRemoteUser(boolean create)
public boolean authenticate()
throws ServletException,
java.io.IOException
authenticate in interface CauchoRequestServletException
java.io.IOExceptionpublic java.lang.String getRemoteUser()
getRemoteUser in interface HttpServletRequestpublic java.security.Principal getUserPrincipal()
getUserPrincipal in interface SecurityContextProvidergetUserPrincipal in interface HttpServletRequestpublic void logout()
logout in interface SecurityContextProviderpublic void logoutUserPrincipal()
public java.lang.String runAs(java.lang.String role)
runAs in interface SecurityContextProviderrole - the new role
public boolean isUserInRole(java.lang.String role)
isUserInRole in interface SecurityContextProviderisUserInRole in interface HttpServletRequestrole - the named role to test.
public boolean isTransportSecure()
isTransportSecure in interface SecurityContextProvider
public ReadStream getStream()
throws java.io.IOException
getStream in interface CauchoRequestjava.io.IOException
public ReadStream getStream(boolean isReader)
throws java.io.IOException
java.io.IOExceptionpublic byte[] getRawReadBuffer()
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 ServletInputStream getInputStream()
throws java.io.IOException
getInputStream in interface ServletRequestjava.io.IOException
public java.io.BufferedReader getReader()
throws java.io.IOException
getReader in interface ServletRequestjava.io.IOExceptionpublic java.util.Enumeration<java.lang.String> getParameterNames()
getParameterN