org.w3c.jigsaw.servlet
Class JigsawHttpServletRequest

java.lang.Object
  |
  +--org.w3c.jigsaw.servlet.JigsawHttpServletRequest

public class JigsawHttpServletRequest
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest


Field Summary
protected  JigsawHttpSession httpSession
           
protected  javax.servlet.ServletInputStream is
           
protected  java.io.BufferedReader reader
           
protected  java.lang.String requestedSessionID
           
protected  JigsawHttpServletResponse response
           
protected  JigsawHttpSessionContext sessionContext
           
static java.lang.String STATE_PARAMETERS
           
 
Method Summary
protected  javax.servlet.http.Cookie convertCookie(HttpCookie httpCookie)
           
protected  javax.servlet.http.Cookie createCookie()
           
 java.lang.Object getAttribute(java.lang.String name)
          ServletRequest implementation - Get an attribute of the request.
 java.util.Enumeration getAttributeNames()
           
 java.lang.String getAuthType()
          HttpServletRequest implementation - Get the request's auth method.
 java.lang.String getCharacterEncoding()
          Return the Charset parameter of content type
 int getContentLength()
          ServletRequest implementation - Get the length of request data.
 java.lang.String getContentType()
          ServletRequest implementation - Get the type of the request's body.
protected  java.lang.String getCookieName()
           
 javax.servlet.http.Cookie[] getCookies()
          Gets the array of cookies found in this request.
 long getDateHeader(java.lang.String name)
          HttpServletRequest implementation - Get a request header as an date.
 java.lang.String getHeader(java.lang.String name)
          HttpServletRequest implementation - Get a request header as a String.
 java.util.Enumeration getHeaderNames()
          HttpServletRequest implementation - Get a all header names.
 javax.servlet.ServletInputStream getInputStream()
          Returns an input stream for reading binary data in the request body.
 int getIntHeader(java.lang.String name)
          HttpServletRequest implementation - Get a request header as an int.
protected  javax.servlet.ServletInputStream getJigsawInputStream()
           
 java.lang.String getMethod()
          HttpServletRequest implementation - Get the request's method.
 java.lang.String getParameter(java.lang.String name)
          ServletRequest implementation - Get a parameter value.
 java.util.Enumeration getParameterNames()
          ServletRequest implementation - List available parameters.
 java.lang.String[] getParameterValues(java.lang.String parameter)
          ServletRequest implementation - Get the parameters value.
 java.lang.String getPathInfo()
          HttpServletRequest implementation - Get the request's path info.
 java.lang.String getPathTranslated()
          HttpServletRequest implementation - Get the request's path translated.
 java.lang.String getProtocol()
          ServletRequest implementation - Get the protocol of that request.
 java.lang.String getQueryString()
          HttpServletRequest implementation - Get the request's query string.
 java.io.BufferedReader getReader()
          Returns a buffered reader for reading text in the request body.
 java.lang.String getRealPath(java.lang.String name)
          Deprecated. since jsdk1.2
 java.lang.String getRemoteAddr()
          ServletRequest implementation - Get the IP address of requests's sender.
 java.lang.String getRemoteHost()
          ServletRequest implementation - FQDN of request's sender.
 java.lang.String getRemoteUser()
          HttpServletRequest implementation - Get the request's user (if any).
protected  org.w3c.jigsaw.http.Request getRequest()
           
 java.lang.String getRequestedSessionId()
          Gets the session id specified with this request.
protected  java.lang.String getRequestedSessionIdFromCookie()
           
protected  java.lang.String getRequestedSessionIdFromURL()
           
 java.lang.String getRequestURI()
          Gets, from the first line of the HTTP request, the part of this request's URI that is to the left of any query string.
 java.lang.String getScheme()
           
 java.lang.String getServerName()
          ServletRequest implementation - Get the name of queried server.
 int getServerPort()
          ServletRequest implementation - Get the port of queried server.
 java.lang.String getServletPath()
          Gets the part of this request's URI that refers to the servlet being invoked.
 javax.servlet.http.HttpSession getSession()
          Gets the current valid session associated with this request.
 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.
protected  javax.servlet.http.HttpSession getSession(java.lang.String sessionId)
           
protected  JigsawHttpSessionContext getSessionContext()
           
protected  java.lang.String getURLParameter(java.lang.String name)
           
 boolean isRequestedSessionIdFromCookie()
          Checks whether the session id specified by this request came in as a cookie.
 boolean isRequestedSessionIdFromUrl()
          Deprecated. since jsdk2.1
 boolean isRequestedSessionIdFromURL()
          Checks whether the session id specified by this request came in as part of the URL.
 boolean isRequestedSessionIdValid()
          Checks whether this request is associated with a session that is valid in the current session context.
 void setAttribute(java.lang.String name, java.lang.Object object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_PARAMETERS

public static final java.lang.String STATE_PARAMETERS

response

protected JigsawHttpServletResponse response

httpSession

protected JigsawHttpSession httpSession

sessionContext

protected JigsawHttpSessionContext sessionContext

requestedSessionID

protected java.lang.String requestedSessionID

is

protected javax.servlet.ServletInputStream is

reader

protected java.io.BufferedReader reader
Method Detail

getURLParameter

protected java.lang.String getURLParameter(java.lang.String name)

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Return the Charset parameter of content type
Returns:
A String instance

getContentLength

public int getContentLength()
ServletRequest implementation - Get the length of request data.
Returns:
An int, or -1.

getContentType

public java.lang.String getContentType()
ServletRequest implementation - Get the type of the request's body.
Returns:
A String encoded mime type, or null.

getProtocol

public java.lang.String getProtocol()
ServletRequest implementation - Get the protocol of that request.
Returns:
A String encoded version of the protocol.

getServerName

public java.lang.String getServerName()
ServletRequest implementation - Get the name of queried server.
Returns:
Name of server, as a String.

getServerPort

public int getServerPort()
ServletRequest implementation - Get the port of queried server.
Returns:
A port number (int).

getRemoteAddr

public java.lang.String getRemoteAddr()
ServletRequest implementation - Get the IP address of requests's sender.
Returns:
Numeric IP address, as a String.

getRemoteHost

public java.lang.String getRemoteHost()
ServletRequest implementation - FQDN of request's sender.
Returns:
Name of client's machine (FQDN).

getRealPath

public java.lang.String getRealPath(java.lang.String name)
Deprecated. since jsdk1.2
ServletRequest implementation - Get real path. Jigsaw realy has no notion of translation stricto sensu (it has much better in fact ;-). This is a pain here.
Returns:
Always null.

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Returns an input stream for reading binary data in the request body.
Throws:
java.lang.IllegalStateException - if getReader has been called on this same request.
java.io.IOException - on other I/O related errors.
See Also:
getReader()

getJigsawInputStream

protected javax.servlet.ServletInputStream getJigsawInputStream()
                                                         throws java.io.IOException
Throws:
java.io.IOException - if an IO error occurs

getParameter

public java.lang.String getParameter(java.lang.String name)
ServletRequest implementation - Get a parameter value.
Returns:
The String encoded value for the parameter.

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String parameter)
ServletRequest implementation - Get the parameters value.
Returns:
The String array encoded value for the parameter.

getParameterNames

public java.util.Enumeration getParameterNames()
ServletRequest implementation - List available parameters.
Returns:
An enumeration of parameter names.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
ServletRequest implementation - Get an attribute of the request. This closely match Jigsaw's notion of request state.
Parameters:
name - The name of the attribute.
Returns:
An object that gives the value of the attribute.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object object)

getAttributeNames

public java.util.Enumeration getAttributeNames()

getMethod

public java.lang.String getMethod()
HttpServletRequest implementation - Get the request's method.
Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance.

getPathInfo

public java.lang.String getPathInfo()
HttpServletRequest implementation - Get the request's path info.
Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance or null.

getPathTranslated

public java.lang.String getPathTranslated()
HttpServletRequest implementation - Get the request's path translated.
Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance or null.

getQueryString

public java.lang.String getQueryString()
HttpServletRequest implementation - Get the request's query string.
Specified by:
getQueryString in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance or null.

getRemoteUser

public java.lang.String getRemoteUser()
HttpServletRequest implementation - Get the request's user (if any).
Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance or null.

getAuthType

public java.lang.String getAuthType()
HttpServletRequest implementation - Get the request's auth method.
Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance or null.

getHeader

public java.lang.String getHeader(java.lang.String name)
HttpServletRequest implementation - Get a request header as a String.
Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest
Returns:
A String instance or null.

getIntHeader

public int getIntHeader(java.lang.String name)
HttpServletRequest implementation - Get a request header as an int.
Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest
Returns:
An int, or -1.

getDateHeader

public long getDateHeader(java.lang.String name)
HttpServletRequest implementation - Get a request header as an date.
Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest
Returns:
An long (as a number of milliseconds), or -1.

getHeaderNames

public java.util.Enumeration getHeaderNames()
HttpServletRequest implementation - Get a all header names.
Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest
Returns:
An enumeration.

getRequestURI

public java.lang.String getRequestURI()
Gets, from the first line of the HTTP request, the part of this request's URI that is to the left of any query string.
Specified by:
getRequestURI in interface javax.servlet.http.HttpServletRequest

getServletPath

public java.lang.String getServletPath()
Gets the part of this request's URI that refers to the servlet being invoked. Analogous to the CGI variable SCRIPT_NAME.
Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest

getScheme

public java.lang.String getScheme()
Returns:
the scheme of the URL used in this request, for example "http", "https", or "ftp". Different schemes have different rules for constructing URLs, as noted in RFC 1738. The URL used to create a request may be reconstructed using this scheme, the server name and port, and additional information such as URIs.

getCookies

public javax.servlet.http.Cookie[] getCookies()
Gets the array of cookies found in this request.
Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest
Returns:
the array of cookies found in this request or null if there is no cookie.

convertCookie

protected javax.servlet.http.Cookie convertCookie(HttpCookie httpCookie)

getRequestedSessionIdFromCookie

protected java.lang.String getRequestedSessionIdFromCookie()

getRequestedSessionIdFromURL

protected java.lang.String getRequestedSessionIdFromURL()

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Gets the session id specified with this request. This may differ from the actual session id. For example, if the request specified an id for an invalid session, then this will get a new session with a new id.
Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest
Returns:
the session id specified by this request, or null if the request did not specify a session id.

getSessionContext

protected JigsawHttpSessionContext getSessionContext()

getSession

public 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.
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Returns:
the session associated with this request or null if create was false and no valid session is associated with this request.

getSession

public javax.servlet.http.HttpSession getSession()
Gets the current valid session associated with this request.
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Returns:
the session associated with this request.

getCookieName

protected java.lang.String getCookieName()

createCookie

protected javax.servlet.http.Cookie createCookie()

getSession

protected javax.servlet.http.HttpSession getSession(java.lang.String sessionId)

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Checks whether this request is associated with a session that is valid in the current session context. If it is not valid, the requested session will never be returned from the getSession method.
Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest
Returns:
true if this request is assocated with a session that is valid in the current session context.

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Checks whether the session id specified by this request came in as a cookie. (The requested session may not be one returned by the getSession method.)
Specified by:
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest
Returns:
true if the session id specified by this request came in as a cookie; false otherwise

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Deprecated. since jsdk2.1
Checks whether the session id specified by this request came in as part of the URL. (The requested session may not be the one returned by the getSession method.)
Specified by:
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest
Returns:
true if the session id specified by the request for this session came in as part of the URL; false otherwise

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Checks whether the session id specified by this request came in as part of the URL. (The requested session may not be the one returned by the getSession method.)
Specified by:
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest
Returns:
true if the session id specified by the request for this session came in as part of the URL; false otherwise

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Returns a buffered reader for reading text in the request body. This translates character set encodings as appropriate.
Throws:
java.io.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.
See Also:
getInputStream()

getRequest

protected org.w3c.jigsaw.http.Request getRequest()