Openfire 3.4.1 Javadoc

org.jivesoftware.util
Class ParamUtils

java.lang.Object
  extended by org.jivesoftware.util.ParamUtils

public class ParamUtils
extends Object

Assists JSP writers in getting parameters and attributes.


Constructor Summary
ParamUtils()
           
 
Method Summary
static String getAttribute(javax.servlet.http.HttpServletRequest request, String name)
          Returns an attribute as a string.
static String getAttribute(javax.servlet.http.HttpServletRequest request, String name, boolean emptyStringsOK)
          Returns an attribute as a string.
static boolean getBooleanAttribute(javax.servlet.http.HttpServletRequest request, String name)
          Returns an attribute as a boolean.
static boolean getBooleanParameter(javax.servlet.http.HttpServletRequest request, String name)
          Returns a parameter as a boolean.
static boolean getBooleanParameter(javax.servlet.http.HttpServletRequest request, String name, boolean defaultVal)
          Returns a parameter as a boolean.
static double getDoubleParameter(javax.servlet.http.HttpServletRequest request, String name, double defaultNum)
          Returns a parameter as a double.
static int getIntAttribute(javax.servlet.http.HttpServletRequest request, String name, int defaultNum)
          Returns an attribute as a int.
static int getIntParameter(javax.servlet.http.HttpServletRequest request, String name, int defaultNum)
          Returns a parameter as an int.
static int[] getIntParameters(javax.servlet.http.HttpServletRequest request, String name, int defaultNum)
          Returns a list of int parameters.
static long getLongAttribute(javax.servlet.http.HttpServletRequest request, String name, long defaultNum)
          Returns an attribute as a long.
static long getLongParameter(javax.servlet.http.HttpServletRequest request, String name, long defaultNum)
          Returns a parameter as a long.
static long[] getLongParameters(javax.servlet.http.HttpServletRequest request, String name, long defaultNum)
          Returns a list of long parameters.
static String getParameter(javax.servlet.http.HttpServletRequest request, String name)
          Returns a parameter as a string.
static String getParameter(javax.servlet.http.HttpServletRequest request, String name, boolean emptyStringsOK)
          Returns a parameter as a string.
static String[] getParameters(javax.servlet.http.HttpServletRequest request, String name)
          Returns a list of parameters of the same name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParamUtils

public ParamUtils()
Method Detail

getParameter

public static String getParameter(javax.servlet.http.HttpServletRequest request,
                                  String name)
Returns a parameter as a string.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
the value of the parameter or null if the parameter was not found or if the parameter is a zero-length string.

getParameter

public static String getParameter(javax.servlet.http.HttpServletRequest request,
                                  String name,
                                  boolean emptyStringsOK)
Returns a parameter as a string.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
emptyStringsOK - return the parameter values even if it is an empty string.
Returns:
the value of the parameter or null if the parameter was not found.

getParameters

public static String[] getParameters(javax.servlet.http.HttpServletRequest request,
                                     String name)
Returns a list of parameters of the same name

Parameters:
request - an HttpServletRequest object.
Returns:
an array of non-null, non-blank strings of the same name. This method will return an empty array if no parameters were found.

getBooleanParameter

public static boolean getBooleanParameter(javax.servlet.http.HttpServletRequest request,
                                          String name)
Returns a parameter as a boolean.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
true if the value of the parameter was "true", false otherwise.

getBooleanParameter

public static boolean getBooleanParameter(javax.servlet.http.HttpServletRequest request,
                                          String name,
                                          boolean defaultVal)
Returns a parameter as a boolean.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
true if the value of the parameter was "true", false otherwise.

getIntParameter

public static int getIntParameter(javax.servlet.http.HttpServletRequest request,
                                  String name,
                                  int defaultNum)
Returns a parameter as an int.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
the int value of the parameter specified or the default value if the parameter is not found.

getIntParameters

public static int[] getIntParameters(javax.servlet.http.HttpServletRequest request,
                                     String name,
                                     int defaultNum)
Returns a list of int parameters.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
defaultNum - the default value of a parameter, if the parameter can't be converted into an int.

getDoubleParameter

public static double getDoubleParameter(javax.servlet.http.HttpServletRequest request,
                                        String name,
                                        double defaultNum)
Returns a parameter as a double.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
the double value of the parameter specified or the default value if the parameter is not found.

getLongParameter

public static long getLongParameter(javax.servlet.http.HttpServletRequest request,
                                    String name,
                                    long defaultNum)
Returns a parameter as a long.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
the long value of the parameter specified or the default value if the parameter is not found.

getLongParameters

public static long[] getLongParameters(javax.servlet.http.HttpServletRequest request,
                                       String name,
                                       long defaultNum)
Returns a list of long parameters.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
defaultNum - the default value of a parameter, if the parameter can't be converted into a long.

getAttribute

public static String getAttribute(javax.servlet.http.HttpServletRequest request,
                                  String name)
Returns an attribute as a string.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get
Returns:
the value of the parameter or null if the parameter was not found or if the parameter is a zero-length string.

getAttribute

public static String getAttribute(javax.servlet.http.HttpServletRequest request,
                                  String name,
                                  boolean emptyStringsOK)
Returns an attribute as a string.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the parameter you want to get.
emptyStringsOK - return the parameter values even if it is an empty string.
Returns:
the value of the parameter or null if the parameter was not found.

getBooleanAttribute

public static boolean getBooleanAttribute(javax.servlet.http.HttpServletRequest request,
                                          String name)
Returns an attribute as a boolean.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the attribute you want to get.
Returns:
true if the value of the attribute is "true", false otherwise.

getIntAttribute

public static int getIntAttribute(javax.servlet.http.HttpServletRequest request,
                                  String name,
                                  int defaultNum)
Returns an attribute as a int.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the attribute you want to get.
Returns:
the int value of the attribute or the default value if the attribute is not found or is a zero length string.

getLongAttribute

public static long getLongAttribute(javax.servlet.http.HttpServletRequest request,
                                    String name,
                                    long defaultNum)
Returns an attribute as a long.

Parameters:
request - the HttpServletRequest object, known as "request" in a JSP page.
name - the name of the attribute you want to get.
Returns:
the long value of the attribute or the default value if the attribute is not found or is a zero length string.

Openfire 3.4.1 Javadoc

Copyright © 2003-2007 Jive Software.