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:net.ontopia.topicmaps.db2tm.SynchronizationServlet.java

private long getLongProperty(ServletConfig config, String propname, long defval) {
    String propval = config.getInitParameter(propname);
    if (propval != null) {
        try {//w w w  . j  a va 2 s  .c om
            return Long.parseLong(propval);
        } catch (NumberFormatException e) {
            log.warn("Invalid long in servlet parameter '{}': {}", propname, propval);
        }
    }
    return defval;
}

From source file:org.onehippo.forge.webservices.swagger.ReflectiveJaxrsConfig.java

@Override
public void init(final ServletConfig servletConfig) {
    super.init(servletConfig);
    final ReflectiveJaxrsScanner reflectiveJaxrsScanner = new ReflectiveJaxrsScanner();
    final String resourcePackageParam = servletConfig.getInitParameter("resourcePackage");
    if (StringUtils.isEmpty(resourcePackageParam)) {
        log.warn(/*from   w w  w.j a  v a  2s. c o  m*/
                "Please specify the resourcePackage init parameter and point it to the package of your webservice resources");
    }
    reflectiveJaxrsScanner.setResourcePackage(resourcePackageParam);
    ScannerFactory.setScanner(reflectiveJaxrsScanner);
}

From source file:com.ctriposs.rest4j.server.Rest4JServlet.java

private long getAsyncTimeout(ServletConfig servletConfig) {
    String asyncTimeout = servletConfig.getInitParameter(ASYNC_TIMEOUT_PARAM);
    if (asyncTimeout != null) {
        return Long.parseLong(asyncTimeout);
    } else {//  ww  w  .j  ava 2 s  . c  o  m
        return DEFAULT_ASYNC_TIMEOUT;
    }
}

From source file:org.jaxygen.apibrowser.APIBrowser.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    classRegistryName = config.getInitParameter("classRegistry");
    beansPathName = config.getInitParameter("servicePath");
}

From source file:be.fedict.eid.idp.sp.protocol.saml2.AbstractAuthenticationResponseServlet.java

/**
 * Get the required servlet init param//  w  w  w  .  ja v a2 s.c o  m
 * 
 * @param parameterName
 *            parameter name
 * @param config
 *            Servlet Config
 * @return the required param value
 * @throws ServletException
 *             no value was found.
 */
protected String getRequiredInitParameter(String parameterName, ServletConfig config) throws ServletException {

    String value = config.getInitParameter(parameterName);
    if (null == value) {
        throw new ServletException(parameterName + " init-param is required");
    }
    return value;
}

From source file:com.ctriposs.rest4j.server.Rest4JServlet.java

private Set<String> getResourcePackageSet(ServletConfig servletConfig) {
    String resourcePackages = servletConfig.getInitParameter(RESOURCE_PACKAGES_PARAM);
    Set<String> resourcePackageSet = new HashSet<String>();
    for (String resourcePackage : resourcePackages.split(PACKAGE_PARAM_SEPARATOR)) {
        resourcePackageSet.add(resourcePackage.trim());
    }/* ww  w  .  ja v  a2s  .  c  o m*/
    return resourcePackageSet;
}

From source file:org.overlord.gadgets.web.server.servlets.RestProxyServlet.java

/**
 * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
 *//* www.  ja  v a  2  s  .c o  m*/
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    proxyName = config.getInitParameter("proxy-name");
    if (proxyName == null)
        throw new ServletException("Missing init parameter 'proxy-name'.");

    proxyUrl = config.getInitParameter("proxy-url");
    if (proxyUrl == null)
        throw new ServletException("Missing init parameter 'proxy-url'.");

    authProviderClassName = config.getInitParameter("authentication-provider");
}

From source file:com.googlecode.webutilities.servlets.WebProxyServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);

    this.baseUri = readString(config.getInitParameter(INIT_PARAM_BASE_URI), "");

    this.requestHeadersToInject = buildHeadersMapFromString(
            readString(config.getInitParameter(INIT_PARAM_INJECT_REQUEST_HEADERS), ""));

    this.responseHeadersToInject = buildHeadersMapFromString(
            readString(config.getInitParameter(INIT_PARAM_INJECT_RESPONSE_HEADERS), ""));

    LOGGER.debug("Servlet initialized: {\n\t{}:{},\n\t{}:{}\n}", INIT_PARAM_BASE_URI, this.baseUri);
}

From source file:info.magnolia.imaging.ImagingServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    storeGeneratedImages = BooleanUtil.toBoolean(config.getInitParameter("storeGeneratedImages"), true);
    validateFileExtension = BooleanUtil.toBoolean(config.getInitParameter("validateFileExtension"), false);
}

From source file:org.efaps.webdav4vfs.WebDAVServlet.java

@Override()
public void init(final ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    String rootUri = servletConfig.getInitParameter("vfs.uri");
    String authDomain = servletConfig.getInitParameter("vfs.auth.domain");
    String authUser = servletConfig.getInitParameter("vfs.auth.user");
    String authPass = servletConfig.getInitParameter("vfs.auth.password");
    try {/*w  w  w .  j a v  a 2s .  c o m*/
        StaticUserAuthenticator userAuthenticator = new StaticUserAuthenticator(authDomain, authUser, authPass);
        FileSystemOptions options = new FileSystemOptions();
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, userAuthenticator);

        VFSBackend.initialize(rootUri, options);
    } catch (FileSystemException e) {
        LOG.error(String.format("can't create file system backend for '%s'", rootUri));
    }
}