org.opengts.war.tools
Class AttributeTools

java.lang.Object
  extended by org.opengts.war.tools.AttributeTools

public class AttributeTools
extends java.lang.Object


Nested Class Summary
static class AttributeTools.MimePart
           
 
Field Summary
static java.lang.String ATTR_MULTIPART
           
static java.lang.String ATTR_RTP
           
static int MAX_BINARY_SIZE
           
static java.lang.String MIMEPART_BYTES
           
static java.lang.String MIMEPART_FILE
           
static java.lang.String MIMEPART_FILENAME
           
static java.lang.String MIMEPART_INCOMPLETE
           
static java.lang.String MIMEPART_NAME
           
static java.lang.String MIMEPART_STRING
           
 
Constructor Summary
AttributeTools()
           
 
Method Summary
protected static void _parseMultipartFormData(javax.servlet.http.HttpServletRequest request, int maxLen, java.io.File fileSaveDir)
          Parse "multipart/form-data" paramters.
static void clearSessionAttributes(javax.servlet.http.HttpSession sess)
          Clears all HttpSession attributes
static void clearSessionAttributes(javax.servlet.ServletRequest req)
          Clears all ServletRequest attributes
static int getContentLength(javax.servlet.http.HttpServletRequest req)
          Gets the content length for the specified Request
static java.lang.String getContentType(javax.servlet.http.HttpServletRequest req)
          Gets the content type for the specified Request
static java.lang.String[] getMatchingKeys(javax.servlet.ServletRequest req, java.lang.String key_)
          Returns an array of keys from the list of session request parameters that match the specified partial key.
static RTProperties getMultipartProperties(javax.servlet.http.HttpServletRequest request)
          Get MultiPart Mime parameters
static java.lang.Object getRequestAttribute(javax.servlet.ServletRequest req, java.lang.String[] key, java.lang.Object dft)
          Returns the value for the specified key from the ServletRequest.
static java.lang.Object getRequestAttribute(javax.servlet.ServletRequest req, java.lang.String key, java.lang.Object dft)
          Returns the value for the specified key from the ServletRequest.
static boolean getRequestBoolean(javax.servlet.ServletRequest req, java.lang.String[] key, boolean dft)
          Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest
static boolean getRequestBoolean(javax.servlet.ServletRequest req, java.lang.String key, boolean dft)
          Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest
static boolean getRequestCheckbox(javax.servlet.ServletRequest req, java.lang.String key)
          Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest.
static boolean getRequestCheckbox(javax.servlet.ServletRequest req, java.lang.String[] key)
          Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest.
static double getRequestDouble(javax.servlet.ServletRequest req, java.lang.String[] key, double dft)
          Returns the Double value of the specified key from the parameter list in the specified ServletRequest
static double getRequestDouble(javax.servlet.ServletRequest req, java.lang.String key, double dft)
          Returns the Double value of the specified key from the parameter list in the specified ServletRequest
static int getRequestInt(javax.servlet.ServletRequest req, java.lang.String[] key, int dft)
          Returns the Int value of the specified key from the parameter list in the specified ServletRequest
static int getRequestInt(javax.servlet.ServletRequest req, java.lang.String key, int dft)
          Returns the Int value of the specified key from the parameter list in the specified ServletRequest
static long getRequestLong(javax.servlet.ServletRequest req, java.lang.String[] key, long dft)
          Returns the Long value of the specified key from the parameter list in the specified ServletRequest
static long getRequestLong(javax.servlet.ServletRequest req, java.lang.String key, long dft)
          Returns the Long value of the specified key from the parameter list in the specified ServletRequest
static java.lang.String getRequestString(javax.servlet.ServletRequest req, java.lang.String[] keyList, java.lang.String dft)
          Returns the String value of the specified key from the parameter list in the specified ServletRequest
static java.lang.String getRequestString(javax.servlet.ServletRequest req, java.lang.String key, java.lang.String dft)
          Returns the String value of the specified key from the parameter list in the specified ServletRequest
static javax.servlet.ServletContext getServletContext(javax.servlet.ServletRequest req)
          Returns the ServletContext from the specified ServletRequest
static javax.servlet.http.HttpSession getSession(javax.servlet.ServletRequest req)
          Returns the HttpSession from the specified ServletRequest
static java.lang.Object getSessionAttribute(javax.servlet.http.HttpSession sess, java.lang.String[] key, java.lang.Object dft)
          Gets the value for the specified attribute key from the specified HttpSession
static java.lang.Object getSessionAttribute(javax.servlet.http.HttpSession sess, java.lang.String key, java.lang.Object dft)
          Gets the value for the specified attribute key from the specified HttpSession
static java.lang.Object getSessionAttribute(javax.servlet.ServletRequest req, java.lang.String[] key, java.lang.Object dft)
          Gets the value for the specified attribute key from the specified ServletRequest
static java.lang.Object getSessionAttribute(javax.servlet.ServletRequest req, java.lang.String key, java.lang.Object dft)
          Gets the value for the specified attribute key from the specified ServletRequest
static boolean getSessionBoolean(javax.servlet.ServletRequest req, java.lang.String[] key, boolean dft)
          Gets the Boolean value for the specified attribute key from the specified ServletRequest
static boolean getSessionBoolean(javax.servlet.ServletRequest req, java.lang.String key, boolean dft)
          Gets the Boolean value for the specified attribute key from the specified ServletRequest
static double getSessionDouble(javax.servlet.ServletRequest req, java.lang.String[] key, double dft)
          Gets the Double value for the specified attribute key from the specified ServletRequest
static double getSessionDouble(javax.servlet.ServletRequest req, java.lang.String key, double dft)
          Gets the Double value for the specified attribute key from the specified ServletRequest
static int getSessionInt(javax.servlet.ServletRequest req, java.lang.String[] key, int dft)
          Gets the Int value for the specified attribute key from the specified ServletRequest
static int getSessionInt(javax.servlet.ServletRequest req, java.lang.String key, int dft)
          Gets the Int value for the specified attribute key from the specified ServletRequest
static long getSessionLong(javax.servlet.ServletRequest req, java.lang.String[] key, long dft)
          Gets the Long value for the specified attribute key from the specified ServletRequest
static long getSessionLong(javax.servlet.ServletRequest req, java.lang.String key, long dft)
          Gets the Long value for the specified attribute key from the specified ServletRequest
static int GetSessionSequence(javax.servlet.http.HttpServletRequest request)
          Returns the current session sequence ID
static java.lang.String getSessionString(javax.servlet.ServletRequest req, java.lang.String[] key, java.lang.String dft)
          Gets the String value for the specified attribute key from the specified ServletRequest
static java.lang.String getSessionString(javax.servlet.ServletRequest req, java.lang.String key, java.lang.String dft)
          Gets the String value for the specified attribute key from the specified ServletRequest
static boolean hasMultipartFormData(javax.servlet.http.HttpServletRequest request)
          Return true if multi-part form data is present
static boolean hasRequestAttribute(javax.servlet.ServletRequest req, java.lang.String key)
          Returns true if the specified key is defined in the parameter list for the specified ServletRequest.
static boolean hasRequestAttribute(javax.servlet.ServletRequest req, java.lang.String[] key)
          Returns true if the specified key is defined in the parameter list for the specified ServletRequest.
static boolean hasSessionAttribute(javax.servlet.http.HttpSession sess, java.lang.String key)
          Returns true if the specified attribute key is defined in the specified HttpSession
static boolean hasSessionAttribute(javax.servlet.http.HttpSession sess, java.lang.String[] key)
          Returns true if the specified attribute key is defined in the specified HttpSession
static boolean hasSessionAttribute(javax.servlet.ServletRequest req, java.lang.String key)
          Returns true if the specified attribute key is defined in the specified ServletRequest
static boolean hasSessionAttribute(javax.servlet.ServletRequest req, java.lang.String[] key)
          Returns true if the specified attribute key is defined in the specified ServletRequest
static void main(java.lang.String[] argv)
           
static boolean parseMultipartFormData(javax.servlet.http.HttpServletRequest request)
          Parse "multipart/form-data" paramters
static boolean parseMultipartFormData(javax.servlet.http.HttpServletRequest request, int maxLen, java.io.File fileSaveDir)
          Parse "multipart/form-data" paramters
static RTProperties parseRTP(javax.servlet.ServletRequest req)
          Looks for and decodes request argument "rtp" and adds any contained properties to the request attributes.
static void printHeaders(javax.servlet.http.HttpServletRequest req, java.lang.String title)
          Print headers
static void printParameters(javax.servlet.http.HttpServletRequest req, java.lang.String title)
          Print Paramewters
static void setSessionAttribute(javax.servlet.http.HttpSession sess, java.lang.String key, java.lang.Object val)
          Sets the HttpSession attribute value for the specified key
static void setSessionAttribute(javax.servlet.ServletRequest req, java.lang.String key, java.lang.Object val)
          Sets the ServletRequest attribute value for the specified key
static void setSessionBoolean(javax.servlet.ServletRequest req, java.lang.String key, boolean val)
          Sets the ServletRequest attribute Boolean value for the specified key
static void setSessionDouble(javax.servlet.ServletRequest req, java.lang.String key, double val)
          Sets the ServletRequest attribute Double value for the specified key
static void setSessionInt(javax.servlet.ServletRequest req, java.lang.String key, int val)
          Sets the ServletRequest attribute Int value for the specified key
static void setSessionLong(javax.servlet.ServletRequest req, java.lang.String key, long val)
          Sets the ServletRequest attribute Long value for the specified key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_RTP

public static final java.lang.String ATTR_RTP
See Also:
Constant Field Values

ATTR_MULTIPART

public static final java.lang.String ATTR_MULTIPART
See Also:
Constant Field Values

MAX_BINARY_SIZE

public static final int MAX_BINARY_SIZE
See Also:
Constant Field Values

MIMEPART_NAME

public static final java.lang.String MIMEPART_NAME
See Also:
Constant Field Values

MIMEPART_FILENAME

public static final java.lang.String MIMEPART_FILENAME
See Also:
Constant Field Values

MIMEPART_FILE

public static final java.lang.String MIMEPART_FILE
See Also:
Constant Field Values

MIMEPART_STRING

public static final java.lang.String MIMEPART_STRING
See Also:
Constant Field Values

MIMEPART_BYTES

public static final java.lang.String MIMEPART_BYTES
See Also:
Constant Field Values

MIMEPART_INCOMPLETE

public static final java.lang.String MIMEPART_INCOMPLETE
See Also:
Constant Field Values
Constructor Detail

AttributeTools

public AttributeTools()
Method Detail

GetSessionSequence

public static int GetSessionSequence(javax.servlet.http.HttpServletRequest request)
Returns the current session sequence ID


printHeaders

public static void printHeaders(javax.servlet.http.HttpServletRequest req,
                                java.lang.String title)
Print headers


printParameters

public static void printParameters(javax.servlet.http.HttpServletRequest req,
                                   java.lang.String title)
Print Paramewters


parseMultipartFormData

public static boolean parseMultipartFormData(javax.servlet.http.HttpServletRequest request)
Parse "multipart/form-data" paramters


getMultipartProperties

public static RTProperties getMultipartProperties(javax.servlet.http.HttpServletRequest request)
Get MultiPart Mime parameters


hasMultipartFormData

public static boolean hasMultipartFormData(javax.servlet.http.HttpServletRequest request)
Return true if multi-part form data is present


parseMultipartFormData

public static boolean parseMultipartFormData(javax.servlet.http.HttpServletRequest request,
                                             int maxLen,
                                             java.io.File fileSaveDir)
Parse "multipart/form-data" paramters


_parseMultipartFormData

protected static void _parseMultipartFormData(javax.servlet.http.HttpServletRequest request,
                                              int maxLen,
                                              java.io.File fileSaveDir)
                                       throws java.io.IOException
Parse "multipart/form-data" paramters. Sets "multi_" attribute in request containing RTProperies instance containing read parameter information.
Reference: http://www.ietf.org/rfc/rfc1867.txt
(This feature is still experimental, and may not be fully supported/implemented)

Parameters:
request - The HttpServletRequest
maxLen - The maximum number of bytes read from a MIME part ('-1' to disregard length limit)
fileSaveDir - The file directory where file types are saved (null to only store data in memory)
Throws:
java.io.IOException - If a IO error occurs

getSession

public static javax.servlet.http.HttpSession getSession(javax.servlet.ServletRequest req)
Returns the HttpSession from the specified ServletRequest

Parameters:
req - The ServletRequest
Returns:
The HttpSession extracted from the specified ServletRequest

getServletContext

public static javax.servlet.ServletContext getServletContext(javax.servlet.ServletRequest req)
Returns the ServletContext from the specified ServletRequest

Parameters:
req - The ServletRequest
Returns:
The ServletContaxt, or null if not found.

getContentType

public static java.lang.String getContentType(javax.servlet.http.HttpServletRequest req)
Gets the content type for the specified Request

Parameters:
req - The request
Returns:
The content type

getContentLength

public static int getContentLength(javax.servlet.http.HttpServletRequest req)
Gets the content length for the specified Request

Parameters:
req - The request
Returns:
The content length

parseRTP

public static RTProperties parseRTP(javax.servlet.ServletRequest req)
Looks for and decodes request argument "rtp" and adds any contained properties to the request attributes.

Parameters:
req - The ServletRequest
Returns:
A copy of the decoded RTProperties

getMatchingKeys

public static java.lang.String[] getMatchingKeys(javax.servlet.ServletRequest req,
                                                 java.lang.String key_)
Returns an array of keys from the list of session request parameters that match the specified partial key.

Parameters:
key_ - The parameter partial key
Returns:
An array of matching parameter keys

hasRequestAttribute

public static boolean hasRequestAttribute(javax.servlet.ServletRequest req,
                                          java.lang.String key)
Returns true if the specified key is defined in the parameter list for the specified ServletRequest.

Parameters:
req - The ServletRequest
key - The key to test
Returns:
True if the specified key is defined.

hasRequestAttribute

public static boolean hasRequestAttribute(javax.servlet.ServletRequest req,
                                          java.lang.String[] key)
Returns true if the specified key is defined in the parameter list for the specified ServletRequest.

Parameters:
req - The ServletRequest
key - An array of keys to test
Returns:
True if the specified key is defined.

getRequestString

public static java.lang.String getRequestString(javax.servlet.ServletRequest req,
                                                java.lang.String key,
                                                java.lang.String dft)
Returns the String value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key to test
dft - The default value to return if the key is not defined
Returns:
The String value of the specified key

getRequestString

public static java.lang.String getRequestString(javax.servlet.ServletRequest req,
                                                java.lang.String[] keyList,
                                                java.lang.String dft)
Returns the String value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
keyList - The keys to test
dft - The default value to return if the key is not defined
Returns:
The String value of the specified key

getRequestDouble

public static double getRequestDouble(javax.servlet.ServletRequest req,
                                      java.lang.String key,
                                      double dft)
Returns the Double value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key to test
dft - The default value to return if the key is not defined, or cannot be converted to a Double.
Returns:
The Double value of the specified key

getRequestDouble

public static double getRequestDouble(javax.servlet.ServletRequest req,
                                      java.lang.String[] key,
                                      double dft)
Returns the Double value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - An array of keys to test
dft - The default value to return if the key is not defined, or cannot be converted to a Double.
Returns:
The Double value of the specified key

getRequestLong

public static long getRequestLong(javax.servlet.ServletRequest req,
                                  java.lang.String key,
                                  long dft)
Returns the Long value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key to test
dft - The default value to return if the key is not defined, or cannot be converted to a Long.
Returns:
The Long value of the specified key

getRequestLong

public static long getRequestLong(javax.servlet.ServletRequest req,
                                  java.lang.String[] key,
                                  long dft)
Returns the Long value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - An array of keys to test
dft - The default value to return if the key is not defined, or cannot be converted to a Long.
Returns:
The Long value of the specified key

getRequestInt

public static int getRequestInt(javax.servlet.ServletRequest req,
                                java.lang.String key,
                                int dft)
Returns the Int value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key to test
dft - The default value to return if the key is not defined, or cannot be converted to a Int.
Returns:
The Int value of the specified key

getRequestInt

public static int getRequestInt(javax.servlet.ServletRequest req,
                                java.lang.String[] key,
                                int dft)
Returns the Int value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - An array of keys to test
dft - The default value to return if the key is not defined, or cannot be converted to a Int.
Returns:
The Int value of the specified key

getRequestBoolean

public static boolean getRequestBoolean(javax.servlet.ServletRequest req,
                                        java.lang.String key,
                                        boolean dft)
Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key to test
dft - The default value to return if the key is not defined, or cannot be converted to a Boolean.
Returns:
The Boolean value of the specified key

getRequestBoolean

public static boolean getRequestBoolean(javax.servlet.ServletRequest req,
                                        java.lang.String[] key,
                                        boolean dft)
Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest

Parameters:
req - The ServletRequest
key - An array of keys to test
dft - The default value to return if the key is not defined, or cannot be converted to a Boolean.
Returns:
The Boolean value of the specified key

getRequestCheckbox

public static boolean getRequestCheckbox(javax.servlet.ServletRequest req,
                                         java.lang.String key)
Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest. The "key" is assumed to represent a CheckBox. A CheckBox will return 'null' if the box is unchecked, which should represent 'false'.

Parameters:
req - The ServletRequest
key - The key to test
Returns:
The Boolean value of the specified key

getRequestCheckbox

public static boolean getRequestCheckbox(javax.servlet.ServletRequest req,
                                         java.lang.String[] key)
Returns the Boolean value of the specified key from the parameter list in the specified ServletRequest. The "key" is assumed to represent a CheckBox. A CheckBox will return 'null' if the box is unchecked, which should represent 'false'.

Parameters:
req - The ServletRequest
key - An array of keys to test
Returns:
The Boolean value of the specified key

hasSessionAttribute

public static boolean hasSessionAttribute(javax.servlet.http.HttpSession sess,
                                          java.lang.String key)
Returns true if the specified attribute key is defined in the specified HttpSession

Parameters:
key - The attribute key to test
Returns:
True if the attribute key is defined

hasSessionAttribute

public static boolean hasSessionAttribute(javax.servlet.http.HttpSession sess,
                                          java.lang.String[] key)
Returns true if the specified attribute key is defined in the specified HttpSession

Parameters:
key - The attribute key to test
Returns:
True if the attribute key is defined

hasSessionAttribute

public static boolean hasSessionAttribute(javax.servlet.ServletRequest req,
                                          java.lang.String key)
Returns true if the specified attribute key is defined in the specified ServletRequest

Parameters:
key - The attribute key to test
Returns:
True if the attribute key is defined

hasSessionAttribute

public static boolean hasSessionAttribute(javax.servlet.ServletRequest req,
                                          java.lang.String[] key)
Returns true if the specified attribute key is defined in the specified ServletRequest

Parameters:
key - The attribute key to test
Returns:
True if the attribute key is defined

getSessionAttribute

public static java.lang.Object getSessionAttribute(javax.servlet.http.HttpSession sess,
                                                   java.lang.String key,
                                                   java.lang.Object dft)
Gets the value for the specified attribute key from the specified HttpSession

Parameters:
sess - The HttpSession
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined.
Returns:
The value of the specified attribute key

getSessionAttribute

public static java.lang.Object getSessionAttribute(javax.servlet.http.HttpSession sess,
                                                   java.lang.String[] key,
                                                   java.lang.Object dft)
Gets the value for the specified attribute key from the specified HttpSession

Parameters:
sess - The HttpSession
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined.
Returns:
The value of the specified attribute key

getSessionAttribute

public static java.lang.Object getSessionAttribute(javax.servlet.ServletRequest req,
                                                   java.lang.String key,
                                                   java.lang.Object dft)
Gets the value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined.
Returns:
The value of the specified attribute key

getSessionAttribute

public static java.lang.Object getSessionAttribute(javax.servlet.ServletRequest req,
                                                   java.lang.String[] key,
                                                   java.lang.Object dft)
Gets the value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined.
Returns:
The value of the specified attribute key

getSessionString

public static java.lang.String getSessionString(javax.servlet.ServletRequest req,
                                                java.lang.String key,
                                                java.lang.String dft)
Gets the String value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined.
Returns:
The String value of the specified attribute key

getSessionString

public static java.lang.String getSessionString(javax.servlet.ServletRequest req,
                                                java.lang.String[] key,
                                                java.lang.String dft)
Gets the String value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined.
Returns:
The String value of the specified attribute key

getSessionDouble

public static double getSessionDouble(javax.servlet.ServletRequest req,
                                      java.lang.String key,
                                      double dft)
Gets the Double value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Double.
Returns:
The Double value of the specified attribute key

getSessionDouble

public static double getSessionDouble(javax.servlet.ServletRequest req,
                                      java.lang.String[] key,
                                      double dft)
Gets the Double value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Double.
Returns:
The Double value of the specified attribute key

getSessionLong

public static long getSessionLong(javax.servlet.ServletRequest req,
                                  java.lang.String key,
                                  long dft)
Gets the Long value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Long.
Returns:
The Long value of the specified attribute key

getSessionLong

public static long getSessionLong(javax.servlet.ServletRequest req,
                                  java.lang.String[] key,
                                  long dft)
Gets the Long value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Long.
Returns:
The Long value of the specified attribute key

getSessionInt

public static int getSessionInt(javax.servlet.ServletRequest req,
                                java.lang.String key,
                                int dft)
Gets the Int value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Int.
Returns:
The Int value of the specified attribute key

getSessionInt

public static int getSessionInt(javax.servlet.ServletRequest req,
                                java.lang.String[] key,
                                int dft)
Gets the Int value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Int.
Returns:
The Int value of the specified attribute key

getSessionBoolean

public static boolean getSessionBoolean(javax.servlet.ServletRequest req,
                                        java.lang.String key,
                                        boolean dft)
Gets the Boolean value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Boolean.
Returns:
The Boolean value of the specified attribute key

getSessionBoolean

public static boolean getSessionBoolean(javax.servlet.ServletRequest req,
                                        java.lang.String[] key,
                                        boolean dft)
Gets the Boolean value for the specified attribute key from the specified ServletRequest

Parameters:
req - The ServletRequest
key - The key for which the attribute value will be returned
dft - The default value returns if the key is not defined, or cannot be converted to a Boolean.
Returns:
The Boolean value of the specified attribute key

getRequestAttribute

public static java.lang.Object getRequestAttribute(javax.servlet.ServletRequest req,
                                                   java.lang.String key,
                                                   java.lang.Object dft)
Returns the value for the specified key from the ServletRequest. The query string is first searched for the key/value. The session attributes are then search if the key/value is not found in the query string.

Parameters:
req - The ServletRequest
key - The key for which the value is to be returned
dft - The default value return if the key is not defined
Returns:
The value of the speciied key

getRequestAttribute

public static java.lang.Object getRequestAttribute(javax.servlet.ServletRequest req,
                                                   java.lang.String[] key,
                                                   java.lang.Object dft)
Returns the value for the specified key from the ServletRequest. The query string is first searched for the key/value. The session attributes are then search if the key/value is not found in the query string.

Parameters:
req - The ServletRequest
key - The key for which the value is to be returned
dft - The default value return if the key is not defined
Returns:
The value of the speciied key

setSessionAttribute

public static void setSessionAttribute(javax.servlet.http.HttpSession sess,
                                       java.lang.String key,
                                       java.lang.Object val)
Sets the HttpSession attribute value for the specified key

Parameters:
sess - The HttpSession
key - The attribute key to set
val - The value to set for the specified key

setSessionAttribute

public static void setSessionAttribute(javax.servlet.ServletRequest req,
                                       java.lang.String key,
                                       java.lang.Object val)
Sets the ServletRequest attribute value for the specified key

Parameters:
req - The ServletRequest
key - The attribute key to set
val - The value to set for the specified key

setSessionDouble

public static void setSessionDouble(javax.servlet.ServletRequest req,
                                    java.lang.String key,
                                    double val)
Sets the ServletRequest attribute Double value for the specified key

Parameters:
req - The ServletRequest
key - The attribute key to set
val - The Double value to set for the specified key

setSessionLong

public static void setSessionLong(javax.servlet.ServletRequest req,
                                  java.lang.String key,
                                  long val)
Sets the ServletRequest attribute Long value for the specified key

Parameters:
req - The ServletRequest
key - The attribute key to set
val - The Long value to set for the specified key

setSessionInt

public static void setSessionInt(javax.servlet.ServletRequest req,
                                 java.lang.String key,
                                 int val)
Sets the ServletRequest attribute Int value for the specified key

Parameters:
req - The ServletRequest
key - The attribute key to set
val - The Int value to set for the specified key

setSessionBoolean

public static void setSessionBoolean(javax.servlet.ServletRequest req,
                                     java.lang.String key,
                                     boolean val)
Sets the ServletRequest attribute Boolean value for the specified key

Parameters:
req - The ServletRequest
key - The attribute key to set
val - The Boolean value to set for the specified key

clearSessionAttributes

public static void clearSessionAttributes(javax.servlet.http.HttpSession sess)
Clears all HttpSession attributes

Parameters:
sess - The HttpSession

clearSessionAttributes

public static void clearSessionAttributes(javax.servlet.ServletRequest req)
Clears all ServletRequest attributes

Parameters:
req - The ServletRequest

main

public static void main(java.lang.String[] argv)