Example usage for javax.servlet ServletConfig getInitParameter

List of usage examples for javax.servlet ServletConfig getInitParameter

Introduction

In this page you can find the example usage for javax.servlet ServletConfig getInitParameter.

Prototype

public String getInitParameter(String name);

Source Link

Document

Gets the value of the initialization parameter with the given name.

Usage

From source file:org.codelabor.system.web.servlet.json.JsonCalendarServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    String tempEncoding = config.getInitParameter("encoding");
    if (!StringUtils.isEmpty(tempEncoding)) {
        encoding = tempEncoding;/*from  w  ww.  j  a va  2 s. c om*/
    }
}

From source file:com.legstar.host.servlet.InitiatorServlet.java

/**
 * Initialization of the servlet. Loads configuration file and creates an
 * instance of the engine handler.// w  w  w .ja  va2s .  c o m
 *
 * @param config the complete configuration hierarchy
 * @throws ServletException if an error occurs
 */
public void init(final ServletConfig config) throws ServletException {
    String configFileName = config.getInitParameter(CONFIG_PARAM);
    if (configFileName == null || configFileName.length() == 0) {
        throw new ServletException("Web.xml does not contain the " + CONFIG_PARAM + " parameter.");
    }

    LOG.info("Initializing with " + configFileName + " configuration file.");

    try {
        LegStarConfigCommons legStarConfig = new LegStarConfigCommons(configFileName);
        EngineHandler serverHandler = new EngineHandler(legStarConfig.getPoolingEngineConfig());

        serverHandler.init();
        ServletContext servletContext = config.getServletContext();
        servletContext.setAttribute(ENGINE_HANDLER_ID, serverHandler);

    } catch (EngineStartupException e) {
        LOG.error("Failed to start engine.", e);
        throw new ServletException(e);
    } catch (LegStarConfigurationException e) {
        LOG.error("Failed to start engine.", e);
        throw new ServletException(e);
    }
}

From source file:org.accelerators.activiti.servlet.SpringApplicationServlet.java

@SuppressWarnings("unchecked")
@Override//from  www.  ja  va 2 s . co m
public void init(ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    applicationBean = servletConfig.getInitParameter("applicationBean");
    if (applicationBean == null) {
        throw new ServletException("ApplicationBean not specified in servlet parameters");
    }

    applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletConfig.getServletContext());

    applicationClass = (Class<? extends Application>) applicationContext.getType(applicationBean);
}

From source file:org.nanoframework.core.plugins.defaults.module.JedisModule.java

@Override
public void config(final ServletConfig config) throws Throwable {
    final String redis = config.getInitParameter(DEFAULT_REDIS_PARAMETER_NAME);
    if (StringUtils.isNotBlank(redis)) {
        final String[] paths = redis.split(";");
        for (final String path : paths) {
            properties.add(PropertiesLoader.load(path));
        }//from w w  w. jav a2s.com
    }

    final String contextRedis = System.getProperty(ApplicationContext.CONTEXT_REDIS);
    if (StringUtils.isNotBlank(contextRedis)) {
        final String[] paths = contextRedis.split(";");
        for (final String path : paths) {
            properties.add(PropertiesLoader.load(path));
        }
    }

    if (CollectionUtils.isEmpty(properties)) {
        try {
            properties.add(PropertiesLoader.load(DEFAULT_REDIS_PATH));
        } catch (final Throwable e) {
            // ignore
        }
    }
}

From source file:ch.entwine.weblounge.kernel.http.WelcomeFileFilterServlet.java

/**
 * {@inheritDoc}//from   w w  w .j  a  v a 2  s .co  m
 *
 * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
 */
public void init(ServletConfig config) throws ServletException {
    String welcomeFilesDelimited = config.getInitParameter(DispatcherConfiguration.WELCOME_FILES);
    if (welcomeFilesDelimited != null)
        welcomeFileList = Arrays.asList(StringUtils.split(welcomeFilesDelimited, ";"));
    appRoot = config.getInitParameter(DispatcherConfiguration.WEBAPP_CONTEXT_ROOT);
    if (appRoot == null || "/".equals(appRoot))
        appRoot = "";
    bundleUriNamespace = config.getInitParameter(DispatcherConfiguration.BUNDLE_CONTEXT_ROOT_URI);
    if (bundleUriNamespace == null || "/".equals(bundleUriNamespace))
        bundleUriNamespace = "";
}

From source file:org.infoscoop.admin.web.AuthenticationServlet.java

public void init(ServletConfig conf) throws ServletException {

    m_userid = conf.getInitParameter("userid");
    m_password = conf.getInitParameter("password");
}

From source file:org.jcommon.com.facebook.servlet.Uploader.java

public void init(ServletConfig config) throws ServletException {
    if (config.getInitParameter("facebook.upload") != null) {
        upload_path = config.getInitParameter("facebook.upload");
        upload_path = System.getProperty("user.dir") + java.io.File.separator + upload_path;
        FileCache.instance().setFile_root(upload_path);
    }//from   w ww .ja  v a2  s .  c  o  m
}

From source file:cn.vlabs.umt.ui.servlet.OnlineStorageLoginServlet.java

public void init(ServletConfig config) throws ServletException {
    onlineStorageURL = config.getInitParameter("onlineStorageURL");
}

From source file:org.fao.geonet.monitor.webapp.GeonetworkHealthCheckServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    String registryAttribute = config.getInitParameter(REGISTRY_ATTRIBUTE_KEY);
    registry = (HealthCheckRegistry) config.getServletContext().getAttribute(registryAttribute);
    if (registry == null) {
        throw new IllegalStateException(
                "Expected a HealthCheckRegistery to be registered in the ServletContext attributes but there was none");
    }//from w ww.  j  a  va2s.c  o m
}

From source file:atd.backend.Login.java

/**
 * Pakt uit web.xml een admin profiel die altijd beschikbaar is
 * //from  w  w  w  .  j a  v  a  2 s .  c o m
 */
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    adminUser = config.getInitParameter("adminUser");
    adminPwd = config.getInitParameter("adminPwd");
}