|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.bind.RequestUtils
Parameter extraction methods, for an approach distinct from data binding, in which parameters of specific types are required. This is very useful for simple submissions.
Constructor Summary | |
RequestUtils()
|
Method Summary | |
static boolean |
getBooleanParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
boolean defaultVal)
Get a boolean parameter, with a fallback value. |
static double |
getDoubleParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
double defaultVal)
Get a double parameter, with a fallback value. |
static float |
getFloatParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
float defaultVal)
Get a double parameter, with a fallback value. |
static int |
getIntParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
int defaultVal)
Get an int parameter, with a fallback value. |
static long |
getLongParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
long defaultVal)
Get an int parameter, with a fallback value. |
static boolean |
getRequiredBooleanParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Get a boolean parameter, throwing an exception if it isn't found or isn't a boolean. |
static double |
getRequiredDoubleParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Get a double parameter, throwing an exception if it isn't found or isn't a number. |
static float |
getRequiredFloatParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Get a double parameter, throwing an exception if it isn't found or isn't a number. |
static int |
getRequiredIntParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Get an int parameter, throwing an exception if it isn't found or isn't a number. |
static long |
getRequiredLongParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Get a long parameter, throwing an exception if it isn't found or isn't a number. |
static java.lang.String |
getRequiredStringParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Get a string parameter, throwing an exception if it isn't found or is empty. |
static java.lang.String |
getStringParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
java.lang.String defaultVal)
Get a string parameter, with a fallback value. |
static void |
rejectRequestMethod(javax.servlet.http.HttpServletRequest request,
java.lang.String method)
Throw a ServletException if the given HTTP request method should be rejected. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RequestUtils()
Method Detail |
public static void rejectRequestMethod(javax.servlet.http.HttpServletRequest request, java.lang.String method) throws javax.servlet.ServletException
request
- request to checkmethod
- method (such as "GET") which should be rejected
javax.servlet.ServletException
- if the given HTTP request is rejectedpublic static int getIntParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, int defaultVal)
public static int getRequiredIntParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ServletRequestBindingException
ServletRequestBindingException:
- subclass of ServletException,
so it doesn't need to be caught
ServletRequestBindingException
public static long getLongParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, long defaultVal)
public static long getRequiredLongParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ServletRequestBindingException
ServletRequestBindingException:
- subclass of ServletException,
so it doesn't need to be caught
ServletRequestBindingException
public static float getFloatParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, float defaultVal)
public static float getRequiredFloatParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ServletRequestBindingException
ServletRequestBindingException:
- subclass of ServletException,
so it doesn't need to be caught
ServletRequestBindingException
public static double getDoubleParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, double defaultVal)
public static double getRequiredDoubleParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ServletRequestBindingException
ServletRequestBindingException:
- subclass of ServletException,
so it doesn't need to be caught
ServletRequestBindingException
public static boolean getBooleanParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean defaultVal)
public static boolean getRequiredBooleanParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ServletRequestBindingException
ServletRequestBindingException:
- subclass of ServletException,
so it doesn't need to be caught
ServletRequestBindingException
public static java.lang.String getStringParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, java.lang.String defaultVal)
public static java.lang.String getRequiredStringParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ServletRequestBindingException
ServletRequestBindingException:
- subclass of ServletException,
so it doesn't need to be caught
ServletRequestBindingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |