public class ServletConfigUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getInitParameter(javax.servlet.ServletConfig servletConfig,
javax.servlet.ServletContext servletContext,
String paramName,
String defaultValue)
Retrieves the init parameter from the servletConfig or servletContext.
|
static String |
getInitParameter(String paramName,
String defaultValue,
Object... configs)
Retrieves the init parameter from the given config objects which must have
String getInitParameter(String); method. |
static boolean |
isBlank(String s)
Utility method to check if the given string is null or empty string or string having white spaces only.
|
static boolean |
isEmpty(String s)
Utility method to check if the given string is null or empty string
|
public static String getInitParameter(javax.servlet.ServletConfig servletConfig, javax.servlet.ServletContext servletContext, String paramName, String defaultValue)
servletConfig
- servletConfig. If null, this is not used.servletContext
- servletContext. If null, this is not used.paramName
- parameter namedefaultValue
- the default valuepublic static String getInitParameter(String paramName, String defaultValue, Object... configs)
String getInitParameter(String);
method.
This utility method used Java Reflection API to invoke String getInitParameter(String);
method.
If the init parameter is not found in the first config object, then it will look up the init parameter from the next config object.
If the parameter is not found, then it will return the defaultValue.paramName
- parameter namedefaultValue
- the default valueconfigs
- public static boolean isEmpty(String s)
s
- public static boolean isBlank(String s)
s
- Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.