com.caucho.server.connection
Class AbstractHttpRequest

java.lang.Object
  extended by com.caucho.server.connection.AbstractHttpRequest
All Implemented Interfaces:
SecurityContextProvider, CauchoRequest, HttpServletRequest, ServletRequest
Direct Known Subclasses:
HmuxRequest, HttpRequest, StubServletRequest

public abstract class AbstractHttpRequest
extends java.lang.Object
implements CauchoRequest, SecurityContextProvider

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

log

protected static final java.util.logging.Logger log

_headerCodes

protected static final CaseInsensitiveIntMap _headerCodes

REQUEST_URI

public static final java.lang.String REQUEST_URI
See Also:
Constant Field Values

CONTEXT_PATH

public static final java.lang.String CONTEXT_PATH
See Also:
Constant Field Values

SERVLET_PATH

public static final java.lang.String SERVLET_PATH
See Also:
Constant Field Values

PATH_INFO

public static final java.lang.String PATH_INFO
See Also:
Constant Field Values

QUERY_STRING

public static final java.lang.String QUERY_STRING
See Also:
Constant Field Values

STATUS_CODE

public static final java.lang.String STATUS_CODE
See Also:
Constant Field Values

EXCEPTION_TYPE

public static final java.lang.String EXCEPTION_TYPE
See Also:
Constant Field Values

MESSAGE

public static final java.lang.String MESSAGE
See Also:
Constant Field Values

EXCEPTION

public static final java.lang.String EXCEPTION
See Also:
Constant Field Values

ERROR_URI

public static final java.lang.String ERROR_URI
See Also:
Constant Field Values

SERVLET_NAME

public static final java.lang.String SERVLET_NAME
See Also:
Constant Field Values

JSP_EXCEPTION

public static final java.lang.String JSP_EXCEPTION
See Also:
Constant Field Values

SHUTDOWN

public static final java.lang.String SHUTDOWN
See Also:
Constant Field Values

_server

protected final DispatchServer _server

_conn

protected final Connection _conn

_tcpConn

protected final TcpConnection _tcpConn

_response

protected AbstractHttpResponse _response

_invocation

protected Invocation _invocation

_hostHeader

protected CharSegment _hostHeader

_expect100Continue

protected boolean _expect100Continue

_sessionGroup

protected int _sessionGroup

_rawRead

protected final ReadStream _rawRead

_readStream

protected final ReadStream _readStream

_hasReadStream

protected boolean _hasReadStream

_calendar

protected final QDate _calendar

_cb

protected final CharBuffer _cb
Constructor Detail

AbstractHttpRequest

protected AbstractHttpRequest(DispatchServer server,
                              Connection conn)
Create a new Request. Because the actual initialization occurs with the start() method, this just allocates statics.

Parameters:
server - the parent server
Method Detail

init

public void init()
Initialization.


getConnection

public final Connection getConnection()
Returns the connection.


getDispatchServer

public final DispatchServer getDispatchServer()
returns the dispatch server.


start

protected void start()
              throws java.io.IOException
Prepare the Request object for a new request.

Parameters:
s - the raw connection stream
Throws:
java.io.IOException

resume

protected void resume()
               throws java.io.IOException
Prepare the Request object for a new request.

Parameters:
s - the raw connection stream
Throws:
java.io.IOException

isIgnoreClientDisconnect

public boolean isIgnoreClientDisconnect()
Returns true if client disconnects should be ignored.


getResponse

public CauchoResponse getResponse()
Returns the response for this request.


getServerName

public java.lang.String getServerName()
Returns the local server name.

Specified by:
getServerName in interface ServletRequest

getHost

protected java.lang.CharSequence getHost()

getServerPort

public int getServerPort()
Returns the server's port.

Specified by:
getServerPort in interface ServletRequest

getLocalPort

public int getLocalPort()
Returns the local port.

Specified by:
getLocalPort in interface ServletRequest

getLocalAddr

public java.lang.String getLocalAddr()
Returns the server's address.

Specified by:
getLocalAddr in interface ServletRequest

getLocalName

public java.lang.String getLocalName()
Returns the server's address.

Specified by:
getLocalName in interface ServletRequest

getRemoteAddr

public java.lang.String getRemoteAddr()
Description copied from interface: ServletRequest
Returns the IP address of the remote host, i.e. the client browser.

Specified by:
getRemoteAddr in interface ServletRequest

printRemoteAddr

public int printRemoteAddr(byte[] buffer,
                           int offset)
                    throws java.io.IOException
Throws:
java.io.IOException

getRemoteHost

public java.lang.String getRemoteHost()
Description copied from interface: ServletRequest
Returns the DNS hostname of the remote host, i.e. the client browser.

Specified by:
getRemoteHost in interface ServletRequest

getRemotePort

public int getRemotePort()
Returns the local port.

Specified by:
getRemotePort in interface ServletRequest

getScheme

public java.lang.String getScheme()
Returns the request's scheme.

Specified by:
getScheme in interface ServletRequest

getProtocol

public abstract java.lang.String getProtocol()
Description copied from interface: ServletRequest
Returns the prococol, e.g. "HTTP/1.1"

Specified by:
getProtocol in interface ServletRequest

getMethod

public abstract java.lang.String getMethod()
Description copied from interface: HttpServletRequest
Returns the HTTP method, e.g. "GET" or "POST"

Equivalent to CGI's REQUEST_METHOD

Specified by:
getMethod in interface HttpServletRequest

getRequestURI

public java.lang.String getRequestURI()
Returns the URI for the request

Specified by:
getRequestURI in interface HttpServletRequest

getPageURI

public java.lang.String getPageURI()
Returns the URI for the page. getPageURI and getRequestURI differ for included files. getPageURI gets the URI for the included page. getRequestURI returns the original URI.

Specified by:
getPageURI in interface CauchoRequest

getUriBuffer

public abstract byte[] getUriBuffer()

getUriLength

public abstract int getUriLength()

getContextPath

public java.lang.String getContextPath()
Returns the context part of the uri. The context part is the part that maps to an webApp.

Specified by:
getContextPath in interface HttpServletRequest

getPageContextPath

public java.lang.String getPageContextPath()
Returns the context part of the uri. For included files, this will return the included context-path.

Specified by:
getPageContextPath in interface CauchoRequest

getServletPath

public java.lang.String getServletPath()
Returns the portion of the uri mapped to the servlet for the original request.

Specified by:
getServletPath in interface HttpServletRequest

getPageServletPath

public java.lang.String getPageServletPath()
Returns the portion of the uri mapped to the servlet for the current page.

Specified by:
getPageServletPath in interface CauchoRequest

getPathInfo

public java.lang.String getPathInfo()
Returns the portion of the uri after the servlet path for the original request.

Specified by:
getPathInfo in interface HttpServletRequest

getPagePathInfo

public java.lang.String getPagePathInfo()
Returns the portion of the uri after the servlet path for the current page.

Specified by:
getPagePathInfo in interface CauchoRequest

getRequestURL

public java.lang.StringBuffer getRequestURL()
Returns the URL for the request

Specified by:
getRequestURL in interface HttpServletRequest

getRealPath

public java.lang.String getRealPath(java.lang.String path)
Deprecated. As of JSDK 2.1

Description copied from interface: ServletRequest
Returns the path of the URI.

Specified by:
getRealPath in interface ServletRequest

getPathTranslated

public java.lang.String getPathTranslated()
Returns the real path of pathInfo.

Specified by:
getPathTranslated in interface HttpServletRequest
Returns:
null if there is no path info.

getQueryString

public java.lang.String getQueryString()
Returns the current page's query string.

Specified by:
getQueryString in interface HttpServletRequest

getPageQueryString

public java.lang.String getPageQueryString()
Returns the current page's query string.

Specified by:
getPageQueryString in interface CauchoRequest

getHeader

public abstract java.lang.String getHeader(java.lang.String key)
Returns the named header.

Specified by:
getHeader in interface HttpServletRequest
Parameters:
key - the header key
Returns:
the header value

getHeaderSize

public int getHeaderSize()
Returns the number of headers.


getHeaderKey

public CharSegment getHeaderKey(int index)
Returns the header key


getHeaderValue

public CharSegment getHeaderValue(int index)
Returns the header value


getHeaderBuffer

public CharSegment getHeaderBuffer(java.lang.String name)
Fills the result with the header values as CharSegment values. Most implementations will implement this directly.

Parameters:
name - the header name

getHeaderNames

public abstract java.util.Enumeration getHeaderNames()
Enumerates the header keys

Specified by:
getHeaderNames in interface HttpServletRequest

setHeader

public void setHeader(java.lang.String key,
                      java.lang.String value)
Sets the header. setHeader is used for Resin's caching to simulate If-None-Match.

Specified by:
setHeader in interface CauchoRequest

addHeaderInt

protected boolean addHeaderInt(char[] keyBuf,
                               int keyOff,
                               int keyLen,
                               CharSegment value)
Adds the header, checking for known values.


connectionClose

protected void connectionClose()
Called for a connection: close


getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Returns an enumeration of the headers for the named attribute.

Specified by:
getHeaders in interface HttpServletRequest
Parameters:
name - the header name
Returns:
an enumeration of the header values.

getHeaderBuffers

public void getHeaderBuffers(java.lang.String name,
                             java.util.ArrayList<CharSegment> resultList)
Fills the result with a list of the header values as CharSegment values. Most implementations will implement this directly.

Parameters:
name - the header name
resultList - the resulting buffer

getIntHeader

public int getIntHeader(java.lang.String key)
Returns the named header, converted to an integer.

Specified by:
getIntHeader in interface HttpServletRequest
Parameters:
key - the header key.
Returns:
the value of the header as an integer.

getDateHeader

public long getDateHeader(java.lang.String key)
Returns a header interpreted as a date.

Specified by:
getDateHeader in interface HttpServletRequest
Parameters:
key - the header key.
Returns:
the value of the header as an integer.

getContentLength

public int getContentLength()
Returns the content length of a post.

Specified by:
getContentLength in interface ServletRequest

getLongContentLength

public long getLongContentLength()
Returns the content length of a post.


getContentType

public java.lang.String getContentType()
Returns the content-length of a post.

Specified by:
getContentType in interface ServletRequest

getContentTypeBuffer

public CharSegment getContentTypeBuffer()
Returns the content-length of a post.


getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the character encoding of a post.

Specified by:
getCharacterEncoding in interface ServletRequest

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException
Sets the character encoding of a post.

Specified by:
setCharacterEncoding in interface ServletRequest
Throws:
java.io.UnsupportedEncodingException

getCookies

public Cookie[] getCookies()
Returns the cookies from the browser

Specified by:
getCookies in interface HttpServletRequest

getCookie

public Cookie getCookie(java.lang.String name)
Returns the named cookie from the browser

Specified by:
getCookie in interface CauchoRequest

setVaryCookie

public void setVaryCookie(java.lang.String cookie)
Called if the page depends on a cookie. If the cookie is null, then the page depends on all cookies.

Specified by:
setVaryCookie in interface CauchoRequest
Parameters:
cookie - the cookie the page depends on.

getVaryCookies

public boolean getVaryCookies()
Returns true if the page depends on cookies.

Specified by:
getVaryCookies in interface CauchoRequest

getVaryCookie

public java.lang.String getVaryCookie()
Returns the cookie the page depends on, or null if the page depends on several cookies.

Specified by:
getVaryCookie in interface CauchoRequest

setHasCookie

public void setHasCookie()
Set when the page actually has a cookie.

Specified by:
setHasCookie in interface CauchoRequest

getHasCookie

public boolean getHasCookie()
True if this page uses cookies.

Specified by:
getHasCookie in interface CauchoRequest

getMemorySession

public HttpSession getMemorySession()
Returns the memory session.

Specified by:
getMemorySession in interface CauchoRequest

getSession

public HttpSession getSession()
Returns the current session, creating one if necessary.

Specified by:
getSession in interface HttpServletRequest

getSession

public HttpSession getSession(boolean create)
Returns the current session.

Specified by:
getSession in interface HttpServletRequest
Parameters:
create - true if a new session should be created
Returns:
the current session

getLoadedSession

public HttpSession getLoadedSession()
Returns the current session.

Parameters:
create - true if a new session should be created
Returns:
the current session

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Returns true if the HTTP request's session id refers to a valid session.

Specified by:
isRequestedSessionIdValid in interface HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Returns true if the current sessionId came from a cookie.

Specified by:
isRequestedSessionIdFromCookie in interface HttpServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Returns true if the current sessionId came from the url.

Specified by:
isRequestedSessionIdFromURL in interface HttpServletRequest

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Deprecated. 

Specified by:
isRequestedSessionIdFromUrl in interface HttpServletRequest

getRequestedSessionIdNoVary

public java.lang.String getRequestedSessionIdNoVary()
Returns the session id in the HTTP request. The cookie has priority over the URL. Because the webApp might be using the cookie to change the page contents, the caching sets vary: JSESSIONID.


getRequestedSessionId

public java.lang.String getRequestedSessionId()
Returns the session id in the HTTP request. The cookie has priority over the URL. Because the webApp might be using the cookie to change the page contents, the caching sets vary: JSESSIONID.

Specified by:
getRequestedSessionId in interface HttpServletRequest

findSessionIdFromConnection

public java.lang.String findSessionIdFromConnection()
For SSL connections, use the SSL identifier.


getSessionGroup

public int getSessionGroup()

getSessionManager

protected final SessionManager getSessionManager()
Returns the session manager.


getSessionCookie

protected final java.lang.String getSessionCookie(SessionManager manager)
Returns the session cookie.


getAuthType

public java.lang.String getAuthType()
Gets the authorization type

Specified by:
getAuthType in interface HttpServletRequest

getRemoteUser

public java.lang.String getRemoteUser(boolean create)
Internal logging return to get the remote user. If the request already knows the user, get it, otherwise just return null.


authenticate

public boolean authenticate()
                     throws ServletException,
                            java.io.IOException
Authenticate the user.

Specified by:
authenticate in interface CauchoRequest
Throws:
ServletException
java.io.IOException

getRemoteUser

public java.lang.String getRemoteUser()
Gets the remote user from the authorization type

Specified by:
getRemoteUser in interface HttpServletRequest

getUserPrincipal

public java.security.Principal getUserPrincipal()
Returns the Principal representing the logged in user.

Specified by:
getUserPrincipal in interface SecurityContextProvider
Specified by:
getUserPrincipal in interface HttpServletRequest
Returns:
the principal in the context or null.

logout

public void logout()
Logs out the principal.

Specified by:
logout in interface SecurityContextProvider

logoutUserPrincipal

public void logoutUserPrincipal()
Clear the principal from the request object.


runAs

public java.lang.String runAs(java.lang.String role)
Sets the overriding role.

Specified by:
runAs in interface SecurityContextProvider
Parameters:
role - the new role
Returns:
the old run-as role

isUserInRole

public boolean isUserInRole(java.lang.String role)
Returns true if the user represented by the current request plays the named role.

Specified by:
isUserInRole in interface SecurityContextProvider
Specified by:
isUserInRole in interface HttpServletRequest
Parameters:
role - the named role to test.
Returns:
true if the user plays the role.

isTransportSecure

public boolean isTransportSecure()
Returns true if the transport is secure.

Specified by:
isTransportSecure in interface SecurityContextProvider

getStream

public ReadStream getStream()
                     throws java.io.IOException
Returns the requests underlying read stream, e.g. the post stream.

Specified by:
getStream in interface CauchoRequest
Throws:
java.io.IOException

getStream

public ReadStream getStream(boolean isReader)
                     throws java.io.IOException
Returns the requests underlying read stream, e.g. the post stream.

Throws:
java.io.IOException

getRawReadBuffer

public byte[] getRawReadBuffer()
Returns the raw read buffer.


skip

protected void skip()
             throws java.io.IOException
Throws:
java.io.IOException

initStream

protected abstract boolean initStream(ReadStream readStream,
                                      ReadStream rawStream)
                               throws java.io.IOException
Initialize the read stream from the raw stream.

Throws:
java.io.IOException

getRawInput

public ReadStream getRawInput()
Returns the raw input stream.


getInputStream

public ServletInputStream getInputStream()
                                  throws java.io.IOException
Returns a stream for reading POST data.

Specified by:
getInputStream in interface ServletRequest
Throws:
java.io.IOException

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Returns a Reader for the POST contents

Specified by:
getReader in interface ServletRequest
Throws:
java.io.IOException

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Returns an enumeration of the form names.

Specified by:
getParameterN