electric.servlet
Class InboundHTTPRequest

java.lang.Object
  extended byelectric.servlet.InboundHTTPRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, IHTTPConstants, javax.servlet.ServletRequest

public final class InboundHTTPRequest
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest, IHTTPConstants

InboundHTTPRequest is an implementation of the standard HttpServletRequest interface.

Author:
webMethods

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Fields inherited from interface electric.util.http.IHTTPConstants
ACCEPT_LANGUAGE, ACCEPT_RANGES, APPLICATION_BINARY, APPLICATION_OCTET_STREAM, ASCII, AUTHORIZATION, BASIC, BOUNDARY, CHARSET_EQUALS, CHUNKED, CLOSE, COLON_SLASH_SLASH, CONNECT, CONNECTION, CONTENT_ID, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, CONTINUATION_STATUS, CONTINUE_EXPECTATION, COOKIE, COOKIE_LISTENER, DATE, DEFAULT_CONTENT_TYPE, DEFAULT_HTTP_CHARSET, DEFAULT_HTTPS_PORT, DEFAULT_MIME_TYPE, DEFAULT_PROXY_PORT, DIGEST, EOL, EXPECT, EXPECT_HEADER, FORM_URLENCODED, GET, GLUE_SESSION, HEAD, HOST, HTTP_1_0, HTTP_1_1, HTTP_PROTOCOL, HTTPS_PROTOCOL, IF_MODIFIED_SINCE, KEEP_ALIVE, LAST_MODIFIED, LOCATION, MD5_HASH, MIME_BOUNDARY, MIME_VERSION, MULTIPART_CONTENT_TYPE, OK, POST, PROXY_AUTHORIZATION, RANGE, SC_CONTINUE, SC_MOVED, SC_MOVED_PERMANENTLY, SC_OK, SC_PROXY_AUTHENTICATION_REQUIRED, SC_UNAUTHORIZED, SEPARATOR, SERVER, SERVER_PREFIX, SERVER_TYPE, SET_COOKIE_0, SET_COOKIE_1, SLASH, START, TEXT_HTML, TEXT_PLAIN, TEXT_XML, TEXT_XML_UTF_8, TRANSFER_ENCODING, USER_AGENT, WWW_AUTHENTICATE
 
Constructor Summary
InboundHTTPRequest()
           
InboundHTTPRequest(IChannel channel)
           
 
Method Summary
 void clearHeaders()
          Clear all of my headers.
 boolean containsHeader(java.lang.String name)
          Return true if there is at least one header with the specified name.
 java.lang.Object getAttribute(java.lang.String name)
          Return the attribute with the specified name, or null if none is found.
 java.util.Enumeration getAttributeNames()
          Return an enumeration over the attribute names.
 ICredentials[] getAuthenticatedCredentials()
           
 java.lang.String getAuthType()
          Returns the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the servlet was not protected.
 IChannel getChannel()
           
 java.lang.String getCharacterEncoding()
          Return my character encoding.
 int getContentLength()
          Return my content length, or -1 if none is defined.
 java.lang.String getContentType()
          Return my content type, or null if none is defined.
 HTTPContext getContext()
          Return the HTTP context associated with this request.
 java.lang.String getContextPath()
           
 javax.servlet.http.Cookie getCookie(java.lang.String name)
          Return the cookie with the specified name, or null if there is none.
 javax.servlet.http.Cookie[] getCookies()
          Return an array of all the cookies, or null if there are none.
 long getDateHeader(java.lang.String name)
          Return the value of the header with the specified name, or -1 if none is defined.
 java.lang.String getHeader(java.lang.String name)
          Return the header with the specified name.
 java.util.Enumeration getHeaderNames()
          Return an enumeration over all the header names.
 MIMEHeaders getHeaders()
           
 java.util.Enumeration getHeaders(java.lang.String name)
          Return an enumeration over all the headers with the specified name.
 javax.servlet.ServletInputStream getInputStream()
           
 int getIntHeader(java.lang.String name)
          Return the value of the header with the specified name, or -1 if none is defined.
 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()
          Return an enumeration of locale objects as specified in the request according to section SRV 4.8 of the servlet spec.
 java.lang.String getMethod()
          Return the method.
 java.lang.String getParameter(java.lang.String name)
          Return the first parameter with the specified name, or null if there is none.
 java.util.Map getParameterMap()
          Return an array of all the parameters with the specified name.
 java.util.Enumeration getParameterNames()
          Return an enumeration over the parameter names.
 java.lang.String[] getParameterValues(java.lang.String name)
          Return an array of all the parameters with the specified name.
 java.lang.String getPathInfo()
          Returns any extra path information associated with the URL the client sent when it made this request.
 java.lang.String getPathTranslated()
           
 java.lang.String getProtocol()
           
 java.lang.String getQueryString()
          Return the query string, or null if there is none.
 java.io.BufferedReader getReader()
           
 java.lang.String getRealPath(java.lang.String path)
           
 java.lang.String getRemoteAddr()
           
 java.lang.String getRemoteHost()
           
 java.lang.String getRemoteUser()
          Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
          Returns a ServletRequestDispatcher object that acts as a wrapper for the resource located at the given path.
 java.lang.String getRequestedSessionId()
           
 java.lang.String getRequestURI()
          Return the request URI.
 java.lang.StringBuffer getRequestURL()
          Return the request URL.
 java.lang.String getScheme()
          Returns the name of the scheme used to make this request, for example, http, https, or ftp.
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.lang.String getServletPath()
          Returns the part of this request s URL that calls the servlet.
 javax.servlet.http.HttpSession getSession()
           
 javax.servlet.http.HttpSession getSession(boolean createIfNotFound)
          Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session, or null if create is false.
 java.security.Principal getUserPrincipal()
          Returns a java.security.Principal object containing the name of the current authenticated user.
 java.lang.String getVersion()
          Return my version.
 boolean isKeepAlive()
           
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 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 readHeaders()
           
 void removeAttribute(java.lang.String name)
          Remove the attribute with the specified name.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Binds an object to a given attribute name in this servlet context.
 void setAuthenticatedCredentials(ICredentials[] authenticatedCredentials)
           
 void setChannel(IChannel channel)
           
 void setCharacterEncoding(java.lang.String newEncoding)
           
 void setConfig(Config config)
           
 void setContentType(java.lang.String type)
          Set my content type.
 void setContext(HTTPContext context)
           
 void setHTTPResponse(OutboundHTTPResponse httpResponse)
           
 void setPathInfo(java.lang.String pathInfo)
           
 void setRemoteUser(java.lang.String user)
           
 void setScheme(java.lang.String scheme)
          Set the scheme.
 void setSecure(boolean isSecure)
          Configure the isSecure flag.
 void setServletPath(java.lang.String servletPath)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InboundHTTPRequest

public InboundHTTPRequest()

InboundHTTPRequest

public InboundHTTPRequest(IChannel channel)
Parameters:
channel -
Method Detail

toString

public java.lang.String toString()

getChannel

public IChannel getChannel()

setChannel

public void setChannel(IChannel channel)
Parameters:
channel -

setContext

public void setContext(HTTPContext context)
Parameters:
context - may be needed internally before config is set
See Also:
FormAuthenticator

getContext

public HTTPContext getContext()
Return the HTTP context associated with this request.

Returns:
the http context associated with this request.
See Also:
OutboundHTTPResponse.sendRedirect(java.lang.String)

setConfig

public void setConfig(Config config)
Parameters:
config -

setHTTPResponse

public void setHTTPResponse(OutboundHTTPResponse httpResponse)
Parameters:
httpResponse -

getVersion

public java.lang.String getVersion()
Return my version.


getMethod

public java.lang.String getMethod()
Return the method.

Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest

getRequestURI

public java.lang.String getRequestURI()
Return the request URI.

Specified by:
getRequestURI in interface javax.servlet.http.HttpServletRequest

getRequestURL

public java.lang.StringBuffer getRequestURL()
Return the request URL.

Specified by:
getRequestURL in interface javax.servlet.http.HttpServletRequest

getQueryString

public java.lang.String getQueryString()
Return the query string, or null if there is none.

Specified by:
getQueryString in interface javax.servlet.http.HttpServletRequest

getContentLength

public int getContentLength()
Return my content length, or -1 if none is defined.

Specified by:
getContentLength in interface javax.servlet.ServletRequest

getContentType

public java.lang.String getContentType()
Return my content type, or null if none is defined.

Specified by:
getContentType in interface javax.servlet.ServletRequest

setContentType

public void setContentType(java.lang.String type)
Set my content type.

Parameters:
type - The new value.

setCharacterEncoding

public void setCharacterEncoding(java.lang.String newEncoding)
                          throws java.io.UnsupportedEncodingException
Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Parameters:
newEncoding -
Throws:
java.io.UnsupportedEncodingException

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Return my character encoding.

Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest

readHeaders

public void readHeaders()
                 throws java.io.IOException
Throws:
java.io.IOException

getHeaders

public MIMEHeaders getHeaders()

clearHeaders

public void clearHeaders()
Clear all of my headers.


getHeader

public java.lang.String getHeader(java.lang.String name)
Return the header with the specified name. If there is more than one header with the given name, return the first one. If there are no headers with the given name, return null.

Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest
Parameters:
name - The name.

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Return an enumeration over all the headers with the specified name.

Specified by:
getHeaders in interface javax.servlet.http.HttpServletRequest
Parameters:
name - The name.

containsHeader

public boolean containsHeader(java.lang.String name)
Return true if there is at least one header with the specified name.

Parameters:
name - The name.

getHeaderNames

public java.util.Enumeration getHeaderNames()
Return an enumeration over all the header names.

Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest

getIntHeader

public int getIntHeader(java.lang.String name)
Return the value of the header with the specified name, or -1 if none is defined.

Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest
Parameters:
name - The name.

getDateHeader

public long getDateHeader(java.lang.String name)
Return the value of the header with the specified name, or -1 if none is defined.

Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest
Parameters:
name - The name.

isKeepAlive

public boolean isKeepAlive()

getLocales

public java.util.Enumeration getLocales()
Return an enumeration of locale objects as specified in the request according to section SRV 4.8 of the servlet spec.

Specified by:
getLocales in interface javax.servlet.ServletRequest
Returns:
an Enumeration of preferred Locale objects for the client

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.

Specified by:
getLocale in interface javax.servlet.ServletRequest
Returns:
the preferred Locale for the client

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Return the attribute with the specified name, or null if none is found.

Specified by:
getAttribute in interface javax.servlet.ServletRequest
Parameters:
name - The name.

getAttributeNames

public java.util.Enumeration getAttributeNames()
Return an enumeration over the attribute names.

Specified by:
getAttributeNames in interface javax.servlet.ServletRequest

removeAttribute

public void removeAttribute(java.lang.String name)
Remove the attribute with the specified name.

Specified by:
removeAttribute in interface javax.servlet.ServletRequest
Parameters:
name - The name.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Binds an object to a given attribute name in this servlet context. If the name specified is already used for an attribute, this method will replace the attribute with the new to the new attribute. If a null value is passed, the effect is the same as calling removeAttribute().

Specified by:
setAttribute in interface javax.servlet.ServletRequest
Parameters:
name - The name.
value - The value.

getParameter

public java.lang.String getParameter(java.lang.String name)
Return the first parameter with the specified name, or null if there is none.

Specified by:
getParameter in interface javax.servlet.ServletRequest
Parameters:
name - The name.

getParameterNames

public java.util.Enumeration getParameterNames()
Return an enumeration over the parameter names.

Specified by:
getParameterNames in interface javax.servlet.ServletRequest

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Return an array of all the parameters with the specified name.

Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Parameters:
name - The name.

getParameterMap

public java.util.Map getParameterMap()
Return an array of all the parameters with the specified name.

Specified by:
getParameterMap in interface javax.servlet.ServletRequest

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Returns a ServletRequestDispatcher object that acts as a wrapper for the resource located at the given path.

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.

Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest
Parameters:
path -

getCookies

public javax.servlet.http.Cookie[] getCookies()
Return an array of all the cookies, or null if there are none.

Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest

getCookie

public javax.servlet.http.Cookie getCookie(java.lang.String name)
Return the cookie with the specified name, or null if there is none.

Parameters:
name -

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Specified by:
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Specified by:
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Specified by:
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest

getSession

public javax.servlet.http.HttpSession getSession()
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest

getSession

public javax.servlet.http.HttpSession getSession(boolean createIfNotFound)
Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session, or null if create is false.

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Parameters:
createIfNotFound - false to get existing session (or null), true to create a session if none existing.
Returns:
session object associated with this request, or null.

getRemoteUser

public java.lang.String getRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.

Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest

setRemoteUser

public void setRemoteUser(java.lang.String user)
Parameters:
user -

isUserInRole

public boolean isUserInRole(java.lang.String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role".

Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest
Parameters:
role -

getUserPrincipal

public java.security.Principal getUserPrincipal()
Returns a java.security.Principal object containing the name of the current authenticated user.

Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest

getAuthType

public java.lang.String getAuthType()
Returns the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the servlet was not protected.

Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest

setAuthenticatedCredentials

public void setAuthenticatedCredentials(ICredentials[] authenticatedCredentials)
Parameters:
authenticatedCredentials -

getAuthenticatedCredentials

public ICredentials[] getAuthenticatedCredentials()

getContextPath

public java.lang.String getContextPath()
Specified by:
getContextPath in interface javax.servlet.http.HttpServletRequest

setServletPath

public void setServletPath(java.lang.String servletPath)
Parameters:
servletPath -

getServletPath

public java.lang.String getServletPath()
Returns the part of this request s URL that calls the servlet. This includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string. Same as the value of the CGI variable SCRIPT_NAME.

Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest

setPathInfo

public void setPathInfo(java.lang.String pathInfo)
Parameters:
pathInfo -

getPathInfo

public java.lang.String getPathInfo()
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string. This method returns null if there was no extra path information. Same as the value of the CGI variable PATH_INFO.

Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest

getRealPath

public java.lang.String getRealPath(java.lang.String path)
Specified by:
getRealPath in interface javax.servlet.ServletRequest
Parameters:
path -

getPathTranslated

public java.lang.String getPathTranslated()
Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest

getRemoteAddr

public java.lang.String getRemoteAddr()
Specified by:
getRemoteAddr in interface javax.servlet.ServletRequest

getRemoteHost

public java.lang.String getRemoteHost()
Specified by:
getRemoteHost in interface javax.servlet.ServletRequest

getScheme

public java.lang.String getScheme()
Returns the name of the scheme used to make this request, for example, http, https, or ftp. Different schemes have different rules for constructing URLs, as noted in RFC 1738.

Specified by:
getScheme in interface javax.servlet.ServletRequest
Returns:
the scheme used to make this request.

setScheme

public void setScheme(java.lang.String scheme)
Set the scheme. This method is part of the GLUE servlet server internal api, and is subject to change between minor versions.

Parameters:
scheme -

getServerName

public java.lang.String getServerName()
Specified by:
getServerName in interface javax.servlet.ServletRequest

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface javax.servlet.ServletRequest

isSecure

public boolean isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

Specified by:
isSecure in interface javax.servlet.ServletRequest
Returns:
true if the request was made using a secure channel, false otherwise.

setSecure

public void setSecure(boolean isSecure)
Configure the isSecure flag. This method is part of the GLUE servlet server internal implementation, and is subject to  * change even between minor versions.

Parameters:
isSecure -
See Also:
IMessageFactory, SSLMessageFactory

getProtocol

public java.lang.String getProtocol()
Specified by:
getProtocol in interface javax.servlet.ServletRequest

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Specified by:
getInputStream in interface javax.servlet.ServletRequest
Throws:
java.io.IOException

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Specified by:
getReader in interface javax.servlet.ServletRequest
Throws:
java.io.IOException


copyright© 2001-2004 by webMethods All Rights Reserved.