## 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 java.lang.String` `encoding`
`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.
`java.lang.String` `getContextPath()` Returns the portion of the request URI that indicates the context of the request.
`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.
`java.util.Enumeration` `getHeaders(java.lang.String name)` Returns all the values of the specified request header as an `Enumeration` of `String` objects.
`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.util.Locale` `getLocale()` Returns the preferred `Locale` that the client will accept content in, based on the Accept-Language header.
`java.util.Enumeration` `getLocales()` Returns an `Enumeration` of `Locale` objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
`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.Map` `getParameterMap()` 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 Request` `getRequest()` Get the wrapped Jigsaw Request.
`javax.servlet.RequestDispatcher` `getRequestDispatcher(java.lang.String path)` Returns a `RequestDispatcher` object that acts as a wrapper for the resource located at the given path.
`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.StringBuffer` `getRequestURL()` 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()`
`protected httpd` `getServer()`
`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)`
`java.security.Principal` `getUserPrincipal()` Returns a `java.security.Principal` object containing the name of the current authenticated user.
`boolean` `hasQueryString()`
`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.
`boolean` `isSecure()` Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
`boolean` `isUserInRole(java.lang.String role)` Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
`void` `removeAttribute(java.lang.String name)` Removes an attribute from this request.
`void` `setAttribute(java.lang.String name, java.lang.Object object)`
`void` `setCharacterEncoding(java.lang.String enc)` Overrides the name of the character encoding used in the body of this request ServletRequest implementation - version 2.3

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

### encoding

    protected java.lang.String encoding

### 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

### setCharacterEncoding

    public void setCharacterEncoding(java.lang.String enc)
                              throws java.io.UnsupportedEncodingException

  Overrides the name of the character encoding used in the body of this request ServletRequest implementation - version 2.3
  Parameters:
    `enc,` - a `String` specifying the encoding String

### 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.

### getServer

    protected httpd getServer()

### 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:
    the real path.

### 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.

### getParameterMap

    public java.util.Map getParameterMap()

  ServletRequest implementation - Get a parameter value. (v2.3)
  Returns:
    a Map of the parameters in this request

### 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)

### removeAttribute

    public void removeAttribute(java.lang.String name)

  Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.

  Attribute names should follow the same conventions as package names. Names beginning with `java.*`, `javax.*`, and `com.sun.*`, are reserved for use by Sun Microsystems.

  Parameters:
    `name` - a `String` specifying the name of the attribute to remove

### getAttributeNames

    public java.util.Enumeration getAttributeNames()

### getLocale

    public java.util.Locale getLocale()

  Returns the preferred `Locale` that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.
  Returns:
    the preferred `Locale` for the client

### getLocales

    public java.util.Enumeration getLocales()

  Returns an `Enumeration` of `Locale` objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns an `Enumeration` containing one `Locale`, the default locale for the server.
  Returns:
    an `Enumeration` of preferred `Locale` objects for the client

### isSecure

    public boolean isSecure()

  Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
  Returns:
    a boolean indicating if the request was made using a secure channel

### 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.

### getContextPath

    public java.lang.String getContextPath()

  Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "".
  Specified by:
    getContextPath in interface javax.servlet.http.HttpServletRequest
  Returns:
    a `String` specifying the portion of the request URI that indicates the context of the request

### hasQueryString

    public boolean hasQueryString()

### 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.

### isUserInRole

    public boolean isUserInRole(java.lang.String role)

  Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns `false`.
  Specified by:
    isUserInRole in interface javax.servlet.http.HttpServletRequest
  Parameters:
    `role` - a `String` specifying the name of the role
  Returns:
    a `boolean` indicating whether the user making this request belongs to a given role; `false` if the user has not been authenticated

### getUserPrincipal

    public java.security.Principal getUserPrincipal()

  Returns a `java.security.Principal` object containing the name of the current authenticated user. If the user has not been authenticated, the method returns `null`.
  Specified by:
    getUserPrincipal in interface javax.servlet.http.HttpServletRequest
  Returns:
    a `java.security.Principal` containing the name of the user making this request; `null` if the user has not been authenticated

### 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.

### getHeaders

    public java.util.Enumeration getHeaders(java.lang.String name)

  Returns all the values of the specified request header as an `Enumeration` of `String` objects.

  Some headers, such as `Accept-Language` can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.

  WARNING, this can't happen with Jigsaw, all multiple values are grouped in one, and only one, header. So, this method always return ONE header value.

  If the request did not include any headers of the specified name, this method returns an empty `Enumeration`. The header name is case insensitive. You can use this method with any request header.

  Specified by:
    getHeaders in interface javax.servlet.http.HttpServletRequest
  Parameters:
    `name` - a `String` specifying the header name
  Returns:
    a `Enumeration` containing the values of the requested header, or `null` if the request does not have any headers of that name

### 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

### getRequestURL

    public java.lang.StringBuffer getRequestURL()

  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.

### getRequestDispatcher

    public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)

  Returns a `RequestDispatcher` object that acts as a wrapper for the resource located at the given path. A `RequestDispatcher` object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.

  The pathname specified may be relative, although it cannot extend outside the current servlet context. If the path begins with a "/" it is interpreted as relative to the current context root. This method returns `null` if the servlet container cannot return a `RequestDispatcher`.

  The difference between this method and `ServletContext.getRequestDispatcher(java.lang.String)` is that this method can take a relative path.

  Parameters:
    `path` - a `String` specifying the pathname to the resource
  Returns:
    a `RequestDispatcher` object that acts as a wrapper for the resource at the specified path
  See Also:
    `RequestDispatcher`, `ServletContext.getRequestDispatcher(java.lang.String)`

### 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 Request getRequest()

  Get the wrapped Jigsaw Request.
  Returns:
    the request