org.dbforms.util
Class ParseUtil

java.lang.Object
  extended by org.dbforms.util.ParseUtil

public class ParseUtil
extends Object

This utility-class provides convenience methods for parsing strings and generating certain data structures

Author:
Joe Peer

Constructor Summary
ParseUtil()
           
 
Method Summary
static FileHolder getFileHolder(HttpServletRequest request, String name)
          Returns a FileHolder object for the specified file pending around in the current request
static String getFirstParameterStartingWith(HttpServletRequest request, String str)
          Get the name of the parameter starting with the input string.
static String getParameter(HttpServletRequest request, String name)
          Returns the value of the named parameter as a String, or null if the parameter was not sent or was sent without a value.
static String getParameter(HttpServletRequest request, String name, String def)
          Returns the value of the named parameter as a String, or the default if the parameter was not sent or was sent without a value.
static Enumeration getParameterNames(HttpServletRequest request)
          Returns the names of all the parameters as an Enumeration of Strings.
static Vector getParametersStartingWith(HttpServletRequest request, String str)
          Get a Vector object containing all the request parameters starting with the input string.
static String[] getParameterValues(HttpServletRequest request, String name)
          Returns the values of the named parameter as a String array, or null if the parameter was not sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParseUtil

public ParseUtil()
Method Detail

getFileHolder

public static FileHolder getFileHolder(HttpServletRequest request,
                                       String name)
Returns a FileHolder object for the specified file pending around in the current request

Parameters:
request - the request object
name - the file name.
Returns:
a FileHolder object for the named file.

getFirstParameterStartingWith

public static String getFirstParameterStartingWith(HttpServletRequest request,
                                                   String str)
Get the name of the parameter starting with the input string.

Parameters:
request - the request object
str - the string to check for
Returns:
the name of the parameter starting with the input string

getParameter

public static String getParameter(HttpServletRequest request,
                                  String name,
                                  String def)
Returns the value of the named parameter as a String, or the default if the parameter was not sent or was sent without a value. The value is guaranteed to be in its normal, decoded form. If the parameter has multiple values, only the first (!!!) one is returned For parameters with multiple values, it's possible the first "value" may be null.

Parameters:
request - the request object
name - the parameter name
def - the default value
Returns:
the parameter value.

getParameter

public static String getParameter(HttpServletRequest request,
                                  String name)
Returns the value of the named parameter as a String, or null if the parameter was not sent or was sent without a value. The value is guaranteed to be in its normal, decoded form. If the parameter has multiple values, only the first (!!!) one is returned For parameters with multiple values, it's possible the first "value" may be null.

Parameters:
request - the request object
name - the parameter name.
Returns:
the parameter value.

getParameterNames

public static Enumeration getParameterNames(HttpServletRequest request)
Returns the names of all the parameters as an Enumeration of Strings. It returns an empty Enumeration if there are no parameters.

Parameters:
request - the request object
Returns:
the names of all the parameters as an Enumeration of Strings.

getParameterValues

public static String[] getParameterValues(HttpServletRequest request,
                                          String name)
Returns the values of the named parameter as a String array, or null if the parameter was not sent. The array has one entry for each parameter field sent. If any field was sent without a value that entry is stored in the array as a null. The values are guaranteed to be in their normal, decoded form. A single value is returned as a one-element array.

Parameters:
request - the request object
name - the parameter name.
Returns:
the parameter values.

getParametersStartingWith

public static Vector getParametersStartingWith(HttpServletRequest request,
                                               String str)
Get a Vector object containing all the request parameters starting with the input string.

Parameters:
request - the request object
str - the string to check for
Returns:
a Vector object containing all the request parameters starting with the input string.


Copyright © 2002-2006 DbForms. All Rights Reserved.