net.trajano.twiff.internal.util
Class InitParamUtil

java.lang.Object
  extended by net.trajano.twiff.internal.util.InitParamUtil

public class InitParamUtil
extends Object

Utility class to get data for initialization parameters.

Author:
Archimedes Trajano

Method Summary
static String getInitParam(ServletConfig servletConfig, String name)
          Gets the initialization parameter.
static String getInitParam(ServletContext servletContext, String name)
          Gets the initialization parameter.
static String safeGetInitParam(ServletConfig servletConfig, String name)
          Gets the initialization parameter.
static String safeGetInitParam(ServletContext servletContext, String name)
          Gets the initialization parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInitParam

public static String getInitParam(ServletConfig servletConfig,
                                  String name)
Gets the initialization parameter. It first tries to look for it in the servlet config, if it is not found it will look in the servlet context, then the defaults, if it is not found it will throw a MissingInitialParameterException.

Parameters:
servletConfig - the servlet config to check for the initialization parameter.
name - the name of the initialization parameter
Returns:
the initialization value

safeGetInitParam

public static String safeGetInitParam(ServletConfig servletConfig,
                                      String name)
Gets the initialization parameter. It first tries to look for it in the servlet config, if it is not found it will look in the servlet context, then the defaults. If it is not found, it returns null.

Parameters:
servletConfig - the servlet config to check for the initialization parameter.
name - the name of the initialization parameter
Returns:
the initialization value

getInitParam

public static String getInitParam(ServletContext servletContext,
                                  String name)
Gets the initialization parameter. It first tries to look for it in the servlet context, then the defaults if it is not found it will throw a MissingInitialParameterException.

Parameters:
servletContext - the servlet context to check for the initialization parameter.
name - the name of the initialization parameter
Returns:
the initialization value

safeGetInitParam

public static String safeGetInitParam(ServletContext servletContext,
                                      String name)
Gets the initialization parameter. It first tries to look for it in the servlet context, then the defaults. If it is not found, it returns null.

Parameters:
servletContext - the servlet context to check for the initialization parameter.
name - the name of the initialization parameter
Returns:
the initialization value


Copyright © 2004-2005 trajano.net. All Rights Reserved.