com.caucho.server.http
Class AbstractCauchoRequest

java.lang.Object
  extended by com.caucho.server.http.AbstractCauchoRequest
All Implemented Interfaces:
CauchoRequest, HttpServletRequest, ServletRequest
Direct Known Subclasses:
CauchoRequestWrapper, HttpServletRequestImpl

public abstract class AbstractCauchoRequest
extends java.lang.Object
implements CauchoRequest


Nested Class Summary
 class AbstractCauchoRequest.PartImpl
           
 
Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
AbstractCauchoRequest()
           
 
Method Summary
 void addCloseOnExit(Path path)
           
 boolean authenticate(HttpServletResponse response)
           
protected  void finishRequest()
           
abstract  AbstractHttpRequest getAbstractHttpRequest()
           
protected  ServletInvocation getInvocation()
           
 HttpSession getLoadedSession()
          Returns the current session.
 HttpSession getMemorySession()
          Returns the memory session.
 java.lang.String getParameter(java.lang.String name)
          Returns the form primary value for the given name.
 java.lang.String getParameterImpl(java.lang.String name)
           
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
          Returns a map of the form.
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMapImpl()
           
 java.util.Enumeration<java.lang.String> getParameterNames()
          Returns an enumeration of the form names.
 java.util.Enumeration<java.lang.String> getParameterNamesImpl()
           
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the form's values for the given name.
 java.lang.String[] getParameterValuesImpl(java.lang.String name)
           
 Part getPart(java.lang.String name)
           
 java.util.Collection<Part> getParts()
           
 java.lang.String getPathTranslated()
          Returns the real path of pathInfo.
 java.lang.String getRealPath(java.lang.String uri)
          Returns the path of the URI.
protected  HttpServletRequest getRequest()
          Returns the next request in a chain.
 RequestDispatcher getRequestDispatcher(java.lang.String path)
          Returns a request dispatcher for later inclusion or forwarding.
 java.lang.StringBuffer getRequestURL()
          Returns the URL for the request
abstract  CauchoResponse getResponse()
           
protected  java.lang.String getRunAs()
           
 Server getServer()
           
 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()
           
abstract  java.lang.String getSessionId()
           
protected  SessionManager getSessionManager()
          Returns the session manager.
 SocketLink getSocketLink()
           
 ReadStream getStream(boolean isFlush)
           
 java.security.Principal getUserPrincipal()
          Returns the Principal representing the logged in user.
abstract  boolean isLoginRequested()
          Returns true if any authentication is requested
 boolean isMultipartEnabled()
           
 boolean isRequestedSessionIdValid()
          Returns true if the HTTP request's session id refers to a valid session.
abstract  boolean isSessionIdFromCookie()
           
 boolean isTop()
           
 boolean isUserInRole(java.lang.String role)
          Returns true if the user represented by the current request plays the named role.
 boolean login(boolean isFail)
           
 void login(java.lang.String username, java.lang.String password)
           
 void mergeParameters(java.util.Map<java.lang.String,java.lang.String[]> source, java.util.Map<java.lang.String,java.lang.String[]> target)
           
protected  void parseGetQueryImpl(HashMapImpl<java.lang.String,java.lang.String[]> form)
           
protected  void parsePostQueryImpl(HashMapImpl<java.lang.String,java.lang.String[]> form)
           
protected  HashMapImpl<java.lang.String,java.lang.String[]> parseQueryImpl()
           
abstract  void requestLogin()
           
abstract  void setSessionId(java.lang.String sessionId)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.server.http.CauchoRequest
getCookie, getHasCookie, getPageContextPath, getPagePathInfo, getPageQueryString, getPageServletPath, getPageURI, getRequestDepth, getServletResponse, getStream, getVaryCookies, getWebApp, hasRequest, isComet, isConnectionClosed, isDuplex, isSuspend, isSyntheticCacheHeader, killKeepalive, setHasCookie, setHeader, setSyntheticCacheHeader, setVaryCookie
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getServletPath, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, logout
 
Methods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
 

Constructor Detail

AbstractCauchoRequest

public AbstractCauchoRequest()
Method Detail

getResponse

public abstract CauchoResponse getResponse()

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String path)
Description copied from interface: ServletRequest
Returns a request dispatcher for later inclusion or forwarding. This is the servlet API equivalent to SSI includes. uri is relative to the request URI. Absolute URIs are relative to the application prefix (getContextPath()).

If getRequestURI() is /myapp/dir/test.jsp and the uri is "inc.jsp", the resulting page is /myapp/dir/inc.jsp.

   RequestDispatcher disp;
   disp = getRequestDispatcher("inc.jsp?a=b");
   disp.include(request, response);
 

Specified by:
getRequestDispatcher in interface ServletRequest
Parameters:
path - path relative to getRequestURI() (including query string) for the included file.
Returns:
RequestDispatcher for later inclusion or forwarding.

getParameterNames

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

Specified by:
getParameterNames in interface ServletRequest

getParameterNamesImpl

public final java.util.Enumeration<java.lang.String> getParameterNamesImpl()

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Returns a map of the form.

Specified by:
getParameterMap in interface ServletRequest

getParameterMapImpl

public final java.util.Map<java.lang.String,java.lang.String[]> getParameterMapImpl()

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns the form's values for the given name.

Specified by:
getParameterValues in interface ServletRequest
Parameters:
name - key in the form
Returns:
value matching the key

getParameterValuesImpl

public final java.lang.String[] getParameterValuesImpl(java.lang.String name)

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the form primary value for the given name.

Specified by:
getParameter in interface ServletRequest
Parameters:
name - the form parameter to return
Returns:
the form value or null if none matches.

getParameterImpl

public final java.lang.String getParameterImpl(java.lang.String name)

getParts

public java.util.Collection<Part> getParts()
                                    throws java.io.IOException,
                                           ServletException
Specified by:
getParts in interface HttpServletRequest
Throws:
java.io.IOException
ServletException

isMultipartEnabled

public boolean isMultipartEnabled()
Specified by:
isMultipartEnabled in interface CauchoRequest

getPart

public Part getPart(java.lang.String name)
             throws java.io.IOException,
                    ServletException
Specified by:
getPart in interface HttpServletRequest
Throws:
java.io.IOException
ServletException
Since:
Servlet 3.0

getAbstractHttpRequest

public abstract AbstractHttpRequest getAbstractHttpRequest()
Specified by:
getAbstractHttpRequest in interface CauchoRequest

getServer

public Server getServer()

parseQueryImpl

protected HashMapImpl<java.lang.String,java.lang.String[]> parseQueryImpl()

parseGetQueryImpl

protected void parseGetQueryImpl(HashMapImpl<java.lang.String,java.lang.String[]> form)

parsePostQueryImpl

protected void parsePostQueryImpl(HashMapImpl<java.lang.String,java.lang.String[]> form)

mergeParameters

public final void mergeParameters(java.util.Map<java.lang.String,java.lang.String[]> source,
                                  java.util.Map<java.lang.String,java.lang.String[]> target)

addCloseOnExit

public void addCloseOnExit(Path path)

getStream

public ReadStream getStream(boolean isFlush)
                     throws java.io.IOException
Throws:
java.io.IOException

getRealPath

public java.lang.String getRealPath(java.lang.String uri)
Description copied from interface: ServletRequest
Returns the path of the URI.

Specified by:
getRealPath in interface ServletRequest

getRequestURL

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

Specified by:
getRequestURL in interface HttpServletRequest

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.

isTop

public boolean isTop()
Specified by:
isTop in interface CauchoRequest

isSessionIdFromCookie

public abstract boolean isSessionIdFromCookie()
Specified by:
isSessionIdFromCookie in interface CauchoRequest

getSessionId

public abstract java.lang.String getSessionId()
Specified by:
getSessionId in interface CauchoRequest

setSessionId

public abstract void setSessionId(java.lang.String sessionId)
Specified by:
setSessionId 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. Sessions are a convenience for keeping user state across requests.

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.

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

getSessionManager

protected final SessionManager getSessionManager()
Returns the session manager.


getSessionCookie

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


getSessionGroup

public int getSessionGroup()

getRunAs

protected java.lang.String getRunAs()

getInvocation

protected ServletInvocation getInvocation()

getRequest

protected HttpServletRequest getRequest()
Returns the next request in a chain.


login

public void login(java.lang.String username,
                  java.lang.String password)
           throws ServletException
Specified by:
login in interface HttpServletRequest
Throws:
ServletException
Since:
Servlet 3.0

login

public boolean login(boolean isFail)
Specified by:
login in interface CauchoRequest

isLoginRequested

public abstract boolean isLoginRequested()
Returns true if any authentication is requested

Specified by:
isLoginRequested in interface CauchoRequest

requestLogin

public abstract void requestLogin()
Specified by:
requestLogin in interface CauchoRequest

authenticate

public boolean authenticate(HttpServletResponse response)
                     throws java.io.IOException,
                            ServletException
Specified by:
authenticate in interface HttpServletRequest
Throws:
java.io.IOException
ServletException
Since:
Servlet 3.0

getUserPrincipal

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

Specified by:
getUserPrincipal in interface HttpServletRequest

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 HttpServletRequest
Parameters:
role - the named role to test.
Returns:
true if the user plays the role.

getSocketLink

public SocketLink getSocketLink()
Specified by:
getSocketLink in interface CauchoRequest

finishRequest

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object