org.objectweb.telosys.service
Class ServiceRequest

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.common.RequestParameters
          extended byorg.objectweb.telosys.service.ServiceRequest
All Implemented Interfaces:
IRequestParameters

public class ServiceRequest
extends RequestParameters

Request object for Telosys RPC and Navigation Services
An instance of this class is created for each request,
it is populated with the http request informations


Constructor Summary
ServiceRequest(java.lang.String sServiceName, javax.servlet.http.HttpServletRequest httpRequest, ScreenSession screenSession)
          Constructor
 
Method Summary
 java.lang.String getFormName()
          Returns the form name (useful only for postback management)
 javax.servlet.http.HttpServletRequest getHttpRequest()
          Returns the standard HTTP servlet request
NB : The original HttpServletRequest is returned "as is",
so it contains the original parameters map with their original encoding
If the request is submitted with a GET http method, the parameters values are not converted in UTF-8
 javax.servlet.http.HttpSession getHttpSession()
          Returns the standard HTTP session or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way
 java.lang.String getHttpSessionId()
          Returns the ID of the standard HTTP session
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way
 int getIntParameter(int iParamNum)
          Deprecated. use getParamAsInt
 int getIntParameter(java.lang.String sParamName)
          Deprecated. use getParamAsInt
 long getLongParameter(int iParamNum)
          Deprecated. use getParamAsLong
 long getLongParameter(java.lang.String sParamName)
          Deprecated. use getParamAsLong
 boolean getParamAsBoolean(int paramNum)
          Returns the 'boolean' value of the 'nth' parameter
 boolean getParamAsBoolean(int paramNum, boolean defaultValue)
          Returns the 'boolean' value of the 'nth' parameter
 byte getParamAsByte(int paramNum)
          Returns the 'byte' value of the 'nth' parameter
 byte getParamAsByte(int paramNum, byte defaultValue)
          Returns the 'byte' value of the 'nth' parameter
 char getParamAsChar(int paramNum)
          Returns the 'char' value of the 'nth' parameter
 char getParamAsChar(int paramNum, char defaultValue)
          Returns the 'char' value of the 'nth' parameter
 java.util.Date getParamAsDate(int paramNum)
          Returns the 'date' value of the 'nth' parameter
The parameter value must be in ISO format : "YYYY-MM-DD" or "HH:MM:SS" or "YYYY-MM-DD HH:MM:SS"
 java.util.Date getParamAsDate(int paramNum, java.util.Date defaultValue)
          Returns the 'date' value of the 'nth' parameter
The parameter value must be in ISO format : "YYYY-MM-DD" or "HH:MM:SS" or "YYYY-MM-DD HH:MM:SS"
 double getParamAsDouble(int paramNum)
          Returns the 'double' value of the 'nth' parameter
 double getParamAsDouble(int paramNum, double defaultValue)
          Returns the 'double' value of the 'nth' parameter
 float getParamAsFloat(int paramNum)
          Returns the 'float' value of the 'nth' parameter
 float getParamAsFloat(int paramNum, float defaultValue)
          Returns the 'float' value of the 'nth' parameter
 int getParamAsInt(int paramNum)
          Returns the 'int' value of the 'nth' parameter
 int getParamAsInt(int paramNum, int defaultValue)
          Returns the 'int' value of the 'nth' parameter
 long getParamAsLong(int paramNum)
          Returns the 'long' value of the 'nth' parameter
 long getParamAsLong(int paramNum, long defaultValue)
          Returns the 'long' value of the 'nth' parameter
 short getParamAsShort(int paramNum)
          Returns the 'short' value of the 'nth' parameter
 short getParamAsShort(int paramNum, short defaultValue)
          Returns the 'short' value of the 'nth' parameter
 java.lang.String getParameter(int iParamNum)
          Returns the 'nth' parameter value
 java.lang.String getParameter(int iParamNum, java.lang.String defaultValue)
          Returns the 'nth' parameter value
 java.lang.String getParameter(java.lang.String paramName)
          Returns the value of the given parameter name, or NULL if not found
 java.lang.String getParameter(java.lang.String paramName, java.lang.String defaultValue)
          Returns the value of the given parameter name, or the default value if not found
 int getParameterCount()
          Return the number of parameters
 java.util.Map getParameterMap()
          Returns the parameters map of the HttpServletRequest object
If the request has been submitted with a GET method, the map contains the parameters converted to UTF-8
NB : each value of the Map is a String array ( cf HttpServletRequest : getParameterMap() )
 java.lang.String[] getParameterNames()
          Returns all the parameter names
 int getPostBackType()
          Returns the "postback" type ( POSTBACK_NONE or POSTBACK_REQUEST or POSTBACK_SESSION )
 ScreenApplication getScreenApplication()
          Returns the ScreenApplication object associated with the current web app
or null if the ScreenApplication has not yet been created (opened)
It cannot returns null, unless the ServletContext has been corrupted by an external way
 java.lang.String getScreenId()
          Returns the screen id (useful only for postback management)
 java.lang.String getScreenName()
          Returns the screen name (useful only for postback management)
 ScreenPostback getScreenPostback()
          Returns the ScreenPostback instance for the current request
There's a ScreenPostback instance only if the postback type is POSTBACK_REQUEST
 ScreenSession getScreenSession()
          Returns the current ScreenSession associated with the request
or null if the HttpSession doesn't exist or if it doesn't contain a ScreenSession attribute
It cannot returns null, unless the HttpSession has been corrupted by an external way
 java.lang.String getServiceName()
          Returns the name of the service invoked
 javax.servlet.ServletContext getServletContext()
          Returns the standard web app ServletContext
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way
 boolean hasParameter()
          Returns true if there's at least one parameter in the request
 boolean submitBy(java.lang.String sSubmitElementName)
          Returns true if the submit element name is present in the request parameters
( useful for forms with multiple submit buttons and/or submit images )
An HTML form can submit a request with
a "button" ( input type="submit" name="abc" : parameter "abc" )
an "image" ( input type="image" name="abc" : parameters "abc.x" and "abc.y" )
 java.lang.String toString()
           
 
Methods inherited from class org.objectweb.telosys.common.RequestParameters
getParamAsBoolean, getParamAsBoolean, getParamAsByte, getParamAsByte, getParamAsChar, getParamAsChar, getParamAsDate, getParamAsDate, getParamAsDouble, getParamAsDouble, getParamAsFloat, getParamAsFloat, getParamAsInt, getParamAsInt, getParamAsLong, getParamAsLong, getParamAsShort, getParamAsShort
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceRequest

public ServiceRequest(java.lang.String sServiceName,
                      javax.servlet.http.HttpServletRequest httpRequest,
                      ScreenSession screenSession)
Constructor

Parameters:
sServiceName -
httpRequest -
screenSession -
Method Detail

getServiceName

public java.lang.String getServiceName()
Returns the name of the service invoked

Returns:

getHttpRequest

public javax.servlet.http.HttpServletRequest getHttpRequest()
Returns the standard HTTP servlet request
NB : The original HttpServletRequest is returned "as is",
so it contains the original parameters map with their original encoding
If the request is submitted with a GET http method, the parameters values are not converted in UTF-8

Returns:

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
Returns the standard HTTP session or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way

Returns:

getHttpSessionId

public java.lang.String getHttpSessionId()
Returns the ID of the standard HTTP session
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way

Returns:

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns the standard web app ServletContext
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way

Returns:

getScreenSession

public ScreenSession getScreenSession()
Returns the current ScreenSession associated with the request
or null if the HttpSession doesn't exist or if it doesn't contain a ScreenSession attribute
It cannot returns null, unless the HttpSession has been corrupted by an external way

Returns:

getScreenApplication

public ScreenApplication getScreenApplication()
Returns the ScreenApplication object associated with the current web app
or null if the ScreenApplication has not yet been created (opened)
It cannot returns null, unless the ServletContext has been corrupted by an external way

Returns:

getPostBackType

public int getPostBackType()
Returns the "postback" type ( POSTBACK_NONE or POSTBACK_REQUEST or POSTBACK_SESSION )

Returns:

getScreenName

public java.lang.String getScreenName()
Returns the screen name (useful only for postback management)

Returns:
the screen name or null

getScreenId

public java.lang.String getScreenId()
Returns the screen id (useful only for postback management)

Returns:
the screen id or null

getFormName

public java.lang.String getFormName()
Returns the form name (useful only for postback management)

Returns:
the form name or null

getScreenPostback

public ScreenPostback getScreenPostback()
Returns the ScreenPostback instance for the current request
There's a ScreenPostback instance only if the postback type is POSTBACK_REQUEST

Returns:

getParameterMap

public java.util.Map getParameterMap()
Returns the parameters map of the HttpServletRequest object
If the request has been submitted with a GET method, the map contains the parameters converted to UTF-8
NB : each value of the Map is a String array ( cf HttpServletRequest : getParameterMap() )

Returns:

getParameterCount

public int getParameterCount()
Return the number of parameters

Returns:

hasParameter

public boolean hasParameter()
Description copied from interface: IRequestParameters
Returns true if there's at least one parameter in the request

Returns:

getParameterNames

public java.lang.String[] getParameterNames()
Returns all the parameter names

Returns:
: Names (never null : size = 0 if no parameters )

getParameter

public java.lang.String getParameter(java.lang.String paramName)
Description copied from interface: IRequestParameters
Returns the value of the given parameter name, or NULL if not found

Specified by:
getParameter in interface IRequestParameters
Specified by:
getParameter in class RequestParameters

getParameter

public java.lang.String getParameter(java.lang.String paramName,
                                     java.lang.String defaultValue)
Description copied from interface: IRequestParameters
Returns the value of the given parameter name, or the default value if not found

Specified by:
getParameter in interface IRequestParameters
Specified by:
getParameter in class RequestParameters

getParameter

public java.lang.String getParameter(int iParamNum)
Returns the 'nth' parameter value

Parameters:
iParamNum - : parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:
: parameter value (or null if not found)

getParameter

public java.lang.String getParameter(int iParamNum,
                                     java.lang.String defaultValue)
Returns the 'nth' parameter value

Parameters:
iParamNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsDouble

public double getParamAsDouble(int paramNum)
Returns the 'double' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsDouble

public double getParamAsDouble(int paramNum,
                               double defaultValue)
Returns the 'double' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsFloat

public float getParamAsFloat(int paramNum)
Returns the 'float' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsFloat

public float getParamAsFloat(int paramNum,
                             float defaultValue)
Returns the 'float' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsInt

public int getParamAsInt(int paramNum)
Returns the 'int' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsInt

public int getParamAsInt(int paramNum,
                         int defaultValue)
Returns the 'int' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsLong

public long getParamAsLong(int paramNum)
Returns the 'long' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsLong

public long getParamAsLong(int paramNum,
                           long defaultValue)
Returns the 'long' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsShort

public short getParamAsShort(int paramNum)
Returns the 'short' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsShort

public short getParamAsShort(int paramNum,
                             short defaultValue)
Returns the 'short' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsByte

public byte getParamAsByte(int paramNum)
Returns the 'byte' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsByte

public byte getParamAsByte(int paramNum,
                           byte defaultValue)
Returns the 'byte' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsChar

public char getParamAsChar(int paramNum)
Returns the 'char' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsChar

public char getParamAsChar(int paramNum,
                           char defaultValue)
Returns the 'char' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsBoolean

public boolean getParamAsBoolean(int paramNum)
Returns the 'boolean' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsBoolean

public boolean getParamAsBoolean(int paramNum,
                                 boolean defaultValue)
Returns the 'boolean' value of the 'nth' parameter

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getParamAsDate

public java.util.Date getParamAsDate(int paramNum)
Returns the 'date' value of the 'nth' parameter
The parameter value must be in ISO format : "YYYY-MM-DD" or "HH:MM:SS" or "YYYY-MM-DD HH:MM:SS"

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:

getParamAsDate

public java.util.Date getParamAsDate(int paramNum,
                                     java.util.Date defaultValue)
Returns the 'date' value of the 'nth' parameter
The parameter value must be in ISO format : "YYYY-MM-DD" or "HH:MM:SS" or "YYYY-MM-DD HH:MM:SS"

Parameters:
paramNum - parameter index ( 1 for "p1", 2 for "p2", ... )
defaultValue - default value (returned if the parameter cannot be found)
Returns:

getIntParameter

public int getIntParameter(java.lang.String sParamName)
                    throws TelosysException
Deprecated. use getParamAsInt

Returns the 'integer' value for the given parameter name

Parameters:
sParamName - : parameter name
Returns:
: parameter value
Throws:
TelosysException - if parameter not found or invalid ( not 'integer' )

getLongParameter

public long getLongParameter(java.lang.String sParamName)
                      throws TelosysException
Deprecated. use getParamAsLong

Returns the 'long' value for the given parameter name

Parameters:
sParamName - : parameter name
Returns:
: parameter value
Throws:
TelosysException - if parameter not found or invalid ( not 'long' )

getIntParameter

public int getIntParameter(int iParamNum)
                    throws TelosysException
Deprecated. use getParamAsInt

Returns the 'integer' value of the 'nth' parameter

Parameters:
iParamNum - : parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:
: parameter value
Throws:
TelosysException - if parameter not found or invalid ( not integer )

getLongParameter

public long getLongParameter(int iParamNum)
                      throws TelosysException
Deprecated. use getParamAsLong

Returns the 'long' value of the 'nth' parameter

Parameters:
iParamNum - : parameter index ( 1 for "p1", 2 for "p2", ... )
Returns:
: parameter value
Throws:
TelosysException - if parameter not found or invalid ( not long )

submitBy

public boolean submitBy(java.lang.String sSubmitElementName)
Returns true if the submit element name is present in the request parameters
( useful for forms with multiple submit buttons and/or submit images )
An HTML form can submit a request with
a "button" ( input type="submit" name="abc" : parameter "abc" )
an "image" ( input type="image" name="abc" : parameters "abc.x" and "abc.y" )

Parameters:
sSubmitElementName -
Returns:

toString

public java.lang.String toString()