|
Enhydra 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.servlet.connectionMethods.http.HttpRequestProcessor | +--org.enhydra.servlet.connectionMethods.http.HttpRequest
Implementation of a HTTP servlet request for the HTTP connection method.
HttpServletRequest
,
ServletRequest
Field Summary | |
protected java.util.Hashtable |
attributes
Request attributes. |
protected java.lang.String |
authType
The auth type, specified externally. |
protected javax.servlet.http.Cookie[] |
cookies
Parser Cookies. |
protected boolean |
getInputStreamCalled
, * Has getInputStream() been called on the current request? |
protected HttpHeaders |
headers
Parsed MIME headers. |
protected java.lang.String |
httpVersion
Request HTTP Version. |
protected org.enhydra.servlet.connectionMethods.http.HttpInputStream |
inputStream
Input stream associated with the socket. |
protected boolean |
keepAlive
Was a keep-alive connection requested? |
protected java.lang.String |
method
Request method. |
protected java.util.Hashtable |
parameters
Parsed parameters from query string or POST. |
protected java.lang.String |
queryString
Query string from URI. |
protected java.io.BufferedReader |
reader
Reader for stream. |
protected java.lang.String |
remoteUser
The remote user, specified externally. |
protected java.lang.String |
requestUri
Request URI (less query string). |
protected java.lang.String |
serverName
The server name. |
protected int |
serverPort
The server port. |
protected javax.servlet.ServletContext |
servletContext
ServletContext object for the current servlet. |
protected java.lang.String |
servletPath
The servlet path. |
protected java.net.Socket |
socket
The socket associated with the request. |
Constructor Summary | |
protected |
HttpRequest()
Construct a new request object. |
Method Summary | |
protected void |
close()
Close the socket associate with this object. |
int |
doRead()
|
int |
doRead(byte[] b,
int off,
int len)
|
protected static java.lang.String |
filePathToUrlPath(java.lang.String filePath)
Convert the a platform-specific file path to a URL file path. |
protected void |
finish()
Indicate the end of handing a request. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of an attribute of the request. |
java.util.Enumeration |
getAttributeNames()
|
java.lang.String |
getAuthType()
Gets the authentication scheme of this request. |
java.lang.String |
getCharacterEncoding()
Get the character set encoding for the input of this request. |
int |
getContentLength()
Get the size of the request data. |
java.lang.String |
getContentType()
Get the content type of the request. |
java.lang.String |
getContextPath()
|
java.lang.String[] |
getCookieHeaders()
|
javax.servlet.http.Cookie[] |
getCookies()
Gets the array of cookies found in this request. |
long |
getDateHeader(java.lang.String name)
Gets the value of the requested date header field of this request. |
java.lang.String |
getHeader(java.lang.String name)
Gets the value of the requested header field of this request. |
java.util.Enumeration |
getHeaderNames()
Gets the header names for this request. |
java.util.Enumeration |
getHeaders(java.lang.String name)
|
javax.servlet.ServletInputStream |
getInputStream()
Get an input stream for reading binary data in the request body. |
int |
getIntHeader(java.lang.String name)
Gets the value of the specified integer header field of this request. |
java.util.Locale |
getLocale()
|
java.util.Enumeration |
getLocales()
|
java.lang.String |
getMethod()
Gets the HTTP method (for example, GET, POST, PUT) with which this request was made. |
org.apache.tomcat.util.MimeHeaders |
getMimeHeaders()
|
java.lang.String |
getParameter(java.lang.String name)
Get a string containing the lone value of the specified parameter. |
java.util.Enumeration |
getParameterNames()
Get the parameter names for this request. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Get the values of the specified parameter for the request. |
protected void |
getParsedParameters()
Parse either the query string or POST input parameters. |
java.lang.String |
getPathInfo()
Gets any optional extra path information following the servlet path of this request's URI, but immediately preceding its query string. |
java.lang.String |
getPathTranslated()
Gets any optional extra path information following the servlet path of this request's URI, but immediately preceding its query string, and translates it to a real path. |
java.lang.String |
getProtocol()
Get the protocol and version of the request. |
java.lang.String |
getQueryString()
Gets any query string that is part of the HTTP request URI. |
java.io.BufferedReader |
getReader()
Returns a buffered reader for reading text in the request body. |
java.lang.String |
getRealPath(java.lang.String path)
Applies alias rules to the specified virtual path and returns the corresponding real path, or null if the translation can not be performed for any reason. |
java.lang.String |
getRemoteAddr()
Get the IP address of the agent that sent the request. |
java.lang.String |
getRemoteHost()
Get the fully qualified host name of the agent that sent the request. |
java.lang.String |
getRemoteUser()
Gets the name of the user making this request. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String name)
|
java.lang.String |
getRequestedSessionId()
Gets the session id specified with this request. |
java.lang.String |
getRequestURI()
Get the part of this request's URI that is to the left of any query string. |
java.lang.String |
getScheme()
Get the scheme of the URL used in this request, for example "http", "https", or "ftp". |
java.lang.String |
getServerName()
Get the host name of the server that received the request. |
int |
getServerPort()
Get the port number on which this request was received. |
java.lang.String |
getServletName()
|
java.lang.String |
getServletPath()
Gets the part of this request's URI that refers to the servlet being invoked. |
java.lang.String |
getServletPrefix()
|
javax.servlet.http.HttpSession |
getSession()
|
javax.servlet.http.HttpSession |
getSession(boolean create)
Gets the current valid session associated with this request, if create is false or, if necessary, creates a new session for the request, if create is true. |
java.security.Principal |
getUserPrincipal()
|
boolean |
isRequestedSessionIdFromCookie()
Checks whether the session id specified by this request came in as a cookie. |
boolean |
isRequestedSessionIdFromUrl()
Checks whether the session id specified by this request came in as part of the URL. |
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
Checks whether this request is associated with a session that is valid in the current session context. |
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
protected boolean |
keepAliveRequested()
Check if keep-alive requested?. |
protected static java.lang.String |
mergeFilePathNames(java.lang.String path1,
java.lang.String path2)
Merge two file path names, avoiding double path seperators. |
protected boolean |
next()
Initialize for a request on a socket. |
void |
recycle()
|
void |
removeAttribute(java.lang.String name)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setAuthType(java.lang.String reqAuthType)
Sets the authentication scheme of this request. |
protected void |
setConnection(java.net.Socket requestSocket)
Associate a connected socket with this object. |
void |
setQueryString(java.lang.String queryString)
Sets any query string that is part of the HTTP request URI. |
void |
setRemoteUser(java.lang.String reqRemoteUser)
Sets the name of the user making this request. |
protected void |
setServletInfo(java.lang.String reqServletPath,
javax.servlet.ServletContext context)
Sets information that can not be obtained from the request. |
protected static java.lang.String |
urlPathToFilePath(java.lang.String urlPath)
Convert the file portion of a URL path to a platform-specific file path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Hashtable attributes
protected java.net.Socket socket
protected org.enhydra.servlet.connectionMethods.http.HttpInputStream inputStream
protected java.lang.String method
protected java.lang.String requestUri
protected java.lang.String httpVersion
protected java.lang.String queryString
protected java.lang.String servletPath
protected java.lang.String serverName
protected int serverPort
protected java.lang.String remoteUser
protected java.lang.String authType
protected HttpHeaders headers
protected javax.servlet.http.Cookie[] cookies
protected java.util.Hashtable parameters
protected javax.servlet.ServletContext servletContext
protected boolean getInputStreamCalled
protected java.io.BufferedReader reader
protected boolean keepAlive
Constructor Detail |
protected HttpRequest()
setConnection
function being called for each
connection.
HttpRequestProcessor#setConnection
,
HttpRequestProcessor#next
,
HttpRequestProcessor#setServletInfo
Method Detail |
protected static java.lang.String mergeFilePathNames(java.lang.String path1, java.lang.String path2)
protected static java.lang.String filePathToUrlPath(java.lang.String filePath)
protected static java.lang.String urlPathToFilePath(java.lang.String urlPath)
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public java.lang.String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
<protocol>/<major version>.<minor
version>
.public java.lang.String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public java.lang.String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletRequest
path
- The virtual path to be translated to a real path.
public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException
getInputStream
in interface javax.servlet.ServletRequest
java.lang.IllegalStateException
- if getReader has been
called on this same request.
java.io.IOException
- on other I/O related errors.getReader
public java.lang.String getParameter(java.lang.String name)
getParameter
in interface javax.servlet.ServletRequest
name
- The name of the parameter whose value is required.
getParameterValues(java.lang.String)
public java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues
in interface javax.servlet.ServletRequest
name
- the name of the parameter whose value is required.
ServletRequest.getParameter(java.lang.String)
public java.util.Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletRequest
name
- The name of the attribute whose value is required.
public java.io.BufferedReader getReader() throws java.io.IOException
getReader
in interface javax.servlet.ServletRequest
UnsupportedEncodingException
- if the character set encoding
is unsupported, so the text can't be correctly decoded.
java.lang.IllegalStateException
- if getInputStream has been
called on this same request.
java.io.IOException
- on other I/O related errors.getInputStream
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
HttpUtils.getRequestURL(javax.servlet.http.HttpServletRequest)
public java.lang.String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public void setQueryString(java.lang.String queryString)
setQueryString
in interface org.apache.tomcat.core.RequestAdapter
public java.lang.String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getHeader(java.lang.String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
name
- The String containing the name of the requested
header field. The comparison is case insensitive.
public int getIntHeader(java.lang.String name)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
name
- The String containing the name of the requested
header field. The comparison is case insensitive.
java.lang.NumberFormatException
- If value of header can't be
converted to an int.public long getDateHeader(java.lang.String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
name
- the String containing the name of the requested
header field. The comparison is case insensitive.
java.lang.IllegalArgumentException
- If value of header can't be
converted to an int.public java.util.Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdValid()
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
getRequestedSessionId()
,
HttpSessionContext
,
getSession(boolean)
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
getSession(boolean)
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
getSession(boolean)
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration getLocales()
getLocales
in interface javax.servlet.ServletRequest
public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration getHeaders(java.lang.String name)
getHeaders
in interface javax.servlet.http.HttpServletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String name)
getRequestDispatcher
in interface javax.servlet.ServletRequest
protected void finish()
public void recycle()
recycle
in interface org.apache.tomcat.core.RequestAdapter
public org.apache.tomcat.util.MimeHeaders getMimeHeaders()
getMimeHeaders
in interface org.apache.tomcat.core.RequestAdapter
public java.lang.String[] getCookieHeaders()
getCookieHeaders
in interface org.apache.tomcat.core.RequestAdapter
public java.lang.String getServletPrefix()
getServletPrefix
in interface org.apache.tomcat.core.RequestAdapter
public java.lang.String getServletName()
getServletName
in interface org.apache.tomcat.core.RequestAdapter
public int doRead() throws java.io.IOException
doRead
in interface org.apache.tomcat.core.RequestAdapter
java.io.IOException
public int doRead(byte[] b, int off, int len) throws java.io.IOException
doRead
in interface org.apache.tomcat.core.RequestAdapter
java.io.IOException
protected void setConnection(java.net.Socket requestSocket) throws java.io.IOException
next
function must be called before a
request can be processed.
requestSocket
- The HTTP connected socket.
java.io.IOException
- If an error occured setting up the socket
input stream.protected void close() throws java.io.IOException
java.io.IOException
- If an error occured setting up the socket
input stream.protected void getParsedParameters()
protected boolean next() throws java.io.IOException
java.io.IOException
- If a parse error or IOException occurs
reading the request.protected void setServletInfo(java.lang.String reqServletPath, javax.servlet.ServletContext context)
reqServletPath
- The servlet path portion of the URL.public void setRemoteUser(java.lang.String reqRemoteUser)
public void setAuthType(java.lang.String reqAuthType)
protected boolean keepAliveRequested()
|
Enhydra 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |