EAF 7.4 Implementation

com.lutris.appserver.server.httpPresentation.servlet
Class ServletHttpPresentationRequest

java.lang.Object
  extended by com.lutris.appserver.server.httpPresentation.servlet.ServletHttpPresentationRequest
All Implemented Interfaces:
com.lutris.appserver.server.httpPresentation.HttpPresentationRequest

public class ServletHttpPresentationRequest
extends java.lang.Object
implements com.lutris.appserver.server.httpPresentation.HttpPresentationRequest

Servlet implementation of the object passed to Presentation objects that is used to access HTTP request data.


Constructor Summary
protected ServletHttpPresentationRequest(javax.servlet.http.HttpServletRequest request)
          Construct an object associated with a servlet request.
 
Method Summary
 java.lang.String getAppFileURIPath(java.lang.String file)
          Get the URI path for a file in the application.
 java.lang.String getApplicationPath()
          Returns the part of the request URI that refers to the application.
 java.lang.String getAuthType()
          Returns the authentication scheme of the request, or null if none.
 int getContentLength()
          Returns the size of the request entity data, or -1 if not known.
 java.lang.String getContentType()
           
 javax.servlet.http.Cookie[] getCookies()
          Gets the array of cookies found in this request.
 long getDateHeader(java.lang.String name)
          Returns the value of a date header field, or -1 if not found.
 java.lang.String getHeader(java.lang.String name)
          Returns the value of a header field, or null if not known.
 java.util.Enumeration getHeaderNames()
          Returns an enumeration of strings representing the header names for this request.
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Returns the original HttpServletRequest.
 com.lutris.appserver.server.httpPresentation.HttpPresentationInputStream getInputStream()
          Returns an input stream for reading the request body.
 int getIntHeader(java.lang.String name)
          Returns the value of an integer header field, or -1 if not found.
 java.lang.String getMethod()
          Returns the method with which the request was made.
 java.lang.String getParameter(java.lang.String name)
          Returns a string containing the lone value of the specified query parameter, or null if the parameter does not exist.
 java.util.Enumeration getParameterNames()
          Returns the parameter names for this request as an enumeration of strings, or an empty enumeration if there are no parameters.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the values of the specified query parameter for the request as an array of strings, or a 0 length array if the named parameter does not exist.
 java.lang.String getPath()
          Returns the part of the request URI that refers to the presentation object being invoked.
 java.lang.String getPathInfo()
          Returns optional extra path information following the presentation path, but immediately preceding the query string.
 java.lang.String getPathTranslated()
          Returns extra path information translated to a real path.
 java.lang.String getPresentationObjectPath()
          Returns the part of the request URI that refers to the presentation object being invoked.
 java.lang.String getPresentationObjectRelativePath()
          Returns the part of the request URI after the presentation manager servlet, upto and including the presentation object .po, but not any path info.
 java.lang.String getPresentationPath()
          Deprecated. This method was named in a confusing manner; it returns the application, not presentation object path. Use getApplicationPath().
 java.lang.String getPresentationURI()
          Returns the presentation URI.
 java.lang.String getProtocol()
          Returns the protocol and version of the request as a string of the form <protocol>/<major version>.<minor version>.
 java.lang.String getQueryString()
          Returns the query string part of the presentation URI, or null if none.
 java.lang.String getRemoteAddr()
          Returns the IP address of the agent that sent the request.
 java.lang.String getRemoteHost()
          Returns the fully qualified host name of the agent that sent the request.
 java.lang.String getRemoteUser()
          Returns the name of the user making this request, or null if not known.
 java.lang.String getRequestURI()
          Returns the request URI.
 java.lang.String getScheme()
          Returns the scheme of the URL used in this request, for example "http", "https", or "ftp".
 java.lang.String getServerName()
          Returns the host name of the server that received the request.
 int getServerPort()
          Returns the port number on which this request was received.
 int getTotalBytes()
          Returns the total number of bytes processed as part of this request.
 boolean isRequestedSessionIdFromCookie()
          Indicates whether client submitted their session id through a cookie
 boolean isRequestedSessionIdFromUrl()
          Indicates whether client submitted their sessionId through a rewritten url
 void setRequestedSessionIdFromCookie(boolean isFromCookie)
           
 void setRequestedSessionIdFromUrl(boolean isFromUrl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletHttpPresentationRequest

protected ServletHttpPresentationRequest(javax.servlet.http.HttpServletRequest request)
Construct an object associated with a servlet request.

Parameters:
request - Servlet request object that this object will front-end.
Method Detail

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Returns the original HttpServletRequest.

Specified by:
getHttpServletRequest in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest

getContentLength

public int getContentLength()
                     throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the size of the request entity data, or -1 if not known. Same as the CGI variable CONTENT_LENGTH.

Specified by:
getContentLength in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getContentType

public java.lang.String getContentType()
                                throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Specified by:
getContentType in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getProtocol

public java.lang.String getProtocol()
                             throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the protocol and version of the request as a string of the form <protocol>/<major version>.<minor version>. Same as the CGI variable SERVER_PROTOCOL.

Specified by:
getProtocol in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

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.

Specified by:
getScheme in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest

getServerName

public java.lang.String getServerName()
Returns the host name of the server that received the request. Same as the CGI variable SERVER_NAME.

Specified by:
getServerName in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest

getServerPort

public int getServerPort()
Returns the port number on which this request was received. Same as the CGI variable SERVER_PORT.

Specified by:
getServerPort in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest

getRemoteAddr

public java.lang.String getRemoteAddr()
                               throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the IP address of the agent that sent the request. Same as the CGI variable REMOTE_ADDR.

Specified by:
getRemoteAddr in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getRemoteHost

public java.lang.String getRemoteHost()
                               throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the fully qualified host name of the agent that sent the request. Same as the CGI variable REMOTE_HOST.

Specified by:
getRemoteHost in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getInputStream

public com.lutris.appserver.server.httpPresentation.HttpPresentationInputStream getInputStream()
                                                                                        throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns an input stream for reading the request body.

Specified by:
getInputStream in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getParameter

public java.lang.String getParameter(java.lang.String name)
                              throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns a string containing the lone value of the specified query parameter, or null if the parameter does not exist. Presentation writers should use this method only when they are sure that there is only one value for the parameter. If the parameter has (or could have) multiple values, then use getParameterValues. If a multiple valued parameter name is passed as an argument, the return value is implementation dependent.

Specified by:
getParameter in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Parameters:
name - the name of the parameter whose value is required.
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException
See Also:
HttpPresentationRequest.getParameterValues(java.lang.String)

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
                                      throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the values of the specified query parameter for the request as an array of strings, or a 0 length array if the named parameter does not exist.

Specified by:
getParameterValues in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Parameters:
name - the name of the parameter whose value is required.
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getParameterNames

public java.util.Enumeration getParameterNames()
                                        throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the parameter names for this request as an enumeration of strings, or an empty enumeration if there are no parameters.

Specified by:
getParameterNames in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getMethod

public java.lang.String getMethod()
                           throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the method with which the request was made. The returned value can be "GET", "HEAD", "POST", or an extension method. Same as the CGI variable REQUEST_METHOD.

Specified by:
getMethod in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getRequestURI

public java.lang.String getRequestURI()
                               throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the request URI.

Specified by:
getRequestURI in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getPresentationURI

public java.lang.String getPresentationURI()
                                    throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the presentation URI.

Specified by:
getPresentationURI in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getPresentationPath

public java.lang.String getPresentationPath()
                                     throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Deprecated. This method was named in a confusing manner; it returns the application, not presentation object path. Use getApplicationPath().

Returns the part of the request URI that refers to the application object being invoked. Analogous to the CGI variable SCRIPT_NAME.

Specified by:
getPresentationPath in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getPresentationObjectPath

public java.lang.String getPresentationObjectPath()
                                           throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the part of the request URI that refers to the presentation object being invoked.

Specified by:
getPresentationObjectPath in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getPresentationObjectRelativePath

public java.lang.String getPresentationObjectRelativePath()
                                                   throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the part of the request URI after the presentation manager servlet, upto and including the presentation object .po, but not any path info. Includes bug fix submitted by Ben Warren

Specified by:
getPresentationObjectRelativePath in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getApplicationPath

public java.lang.String getApplicationPath()
                                    throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the part of the request URI that refers to the application. Analogous to the CGI variable SCRIPT_NAME.

Specified by:
getApplicationPath in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getPathInfo

public java.lang.String getPathInfo()
                             throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns optional extra path information following the presentation path, but immediately preceding the query string. Returns null if not specified. Same as the CGI variable PATH_INFO.

Specified by:
getPathInfo in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getPathTranslated

public java.lang.String getPathTranslated()
                                   throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns extra path information translated to a real path. Returns null if no extra path information specified. Same as the CGI variable PATH_TRANSLATED.

Specified by:
getPathTranslated in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getQueryString

public java.lang.String getQueryString()
                                throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the query string part of the presentation URI, or null if none. Same as the CGI variable QUERY_STRING.

Specified by:
getQueryString in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getRemoteUser

public java.lang.String getRemoteUser()
                               throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the name of the user making this request, or null if not known. The user name is set with HTTP authentication. Whether the user name will continue to be sent with each subsequent communication is browser-dependent. Same as the CGI variable REMOTE_USER.

Specified by:
getRemoteUser in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getAuthType

public java.lang.String getAuthType()
                             throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the authentication scheme of the request, or null if none. Same as the CGI variable AUTH_TYPE.

Specified by:
getAuthType in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getCookies

public javax.servlet.http.Cookie[] getCookies()
                                       throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Gets the array of cookies found in this request.

Specified by:
getCookies in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Returns:
The array of cookies found in this request.
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

setRequestedSessionIdFromCookie

public void setRequestedSessionIdFromCookie(boolean isFromCookie)
                                     throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Specified by:
setRequestedSessionIdFromCookie in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
                                       throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Indicates whether client submitted their session id through a cookie

Specified by:
isRequestedSessionIdFromCookie in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Returns:
true if client submitted their sessionId via a cookie, false otherwise
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

setRequestedSessionIdFromUrl

public void setRequestedSessionIdFromUrl(boolean isFromUrl)
                                  throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Specified by:
setRequestedSessionIdFromUrl in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
                                    throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Indicates whether client submitted their sessionId through a rewritten url

Specified by:
isRequestedSessionIdFromUrl in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Returns:
true if client submitted their sessionId via a rewritten url
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getHeader

public java.lang.String getHeader(java.lang.String name)
                           throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the value of a header field, or null if not known. The case of the header field name is ignored.

Specified by:
getHeader in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Parameters:
name - the case-insensitive header field name
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getIntHeader

public int getIntHeader(java.lang.String name)
                 throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the value of an integer header field, or -1 if not found. The case of the header field name is ignored.

Specified by:
getIntHeader in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Parameters:
name - the case-insensitive header field name
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getDateHeader

public long getDateHeader(java.lang.String name)
                   throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the value of a date header field, or -1 if not found. The case of the header field name is ignored.

Specified by:
getDateHeader in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Parameters:
name - the case-insensitive header field name
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getHeaderNames

public java.util.Enumeration getHeaderNames()
                                     throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns an enumeration of strings representing the header names for this request. Some server implementations do not allow headers to be accessed in this way, in which case this method will return null.

Specified by:
getHeaderNames in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getAppFileURIPath

public java.lang.String getAppFileURIPath(java.lang.String file)
                                   throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Get the URI path for a file in the application. This converts a path to the file part of the URL. It adds in the reference to application servlet.

Specified by:
getAppFileURIPath in interface com.lutris.appserver.server.httpPresentation.HttpPresentationRequest
Parameters:
file - File with in the application. Currently this must be a path relative to the presentation prefix.
Returns:
The file path portion of the URL, starting with a /.
Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException

getTotalBytes

public int getTotalBytes()
Returns the total number of bytes processed as part of this request. This is not supported for Jolt Presentations and is necessary to support the DebugRequest interface.

See Also:
com.lutris.http.debug.DebugRequest

getPath

public java.lang.String getPath()
                         throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Returns the part of the request URI that refers to the presentation object being invoked. This is the same as getPresentationPath(), but is necessary to support the DebugRequest interface.

Throws:
com.lutris.appserver.server.httpPresentation.HttpPresentationException
See Also:
com.lutris.http.debug.DebugRequest

EAF 7.4 Implementation