org.hippoecm.hst.util
Class ServletConfigUtils

java.lang.Object
  extended by org.hippoecm.hst.util.ServletConfigUtils

public class ServletConfigUtils
extends Object

ServletConfig Utils

Version:
$Id: ServletConfigUtils.java 24165 2010-10-04 07:48:54Z bvdschans $

Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInitParameter

public static String getInitParameter(javax.servlet.ServletConfig servletConfig,
                                      javax.servlet.ServletContext servletContext,
                                      String paramName,
                                      String defaultValue)
Retrieves the init parameter from the servletConfig or servletContext. If the init parameter is not found in servletConfig, then it will look up the init parameter from the servletContext. If either servletConfig or servletContext is null, then either is not used to look up the init parameter. If the parameter is not found, then it will return the defaultValue.

Parameters:
servletConfig - servletConfig. If null, this is not used.
servletContext - servletContext. If null, this is not used.
paramName - parameter name
defaultValue - the default value
Returns:

getInitParameter

public 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. 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.

Parameters:
paramName - parameter name
defaultValue - the default value
configs -
Returns:

isEmpty

public static boolean isEmpty(String s)
Utility method to check if the given string is null or empty string

Parameters:
s -

isBlank

public static boolean isBlank(String s)
Utility method to check if the given string is null or empty string or string having white spaces only.

Parameters:
s -


Copyright © 2008-2012 Hippo. All Rights Reserved.