Example usage for javax.servlet.http HttpServlet getInitParameter

List of usage examples for javax.servlet.http HttpServlet getInitParameter

Introduction

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

Prototype

public String getInitParameter(String name) 

Source Link

Document

Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist.

Usage

From source file:org.apache.axis.transport.http.AxisServletBase.java

/**
 * extract information from the servlet configuration files
 * @param servlet//from   ww w . j  av a  2s.  c o  m
 * @return
 */
protected static Map getEngineEnvironment(HttpServlet servlet) {
    Map environment = new HashMap();

    String attdir = servlet.getInitParameter(AxisEngine.ENV_ATTACHMENT_DIR);
    if (attdir != null)
        environment.put(AxisEngine.ENV_ATTACHMENT_DIR, attdir);

    ServletContext context = servlet.getServletContext();
    environment.put(AxisEngine.ENV_SERVLET_CONTEXT, context);

    String webInfPath = context.getRealPath("/WEB-INF");
    if (webInfPath != null)
        environment.put(AxisEngine.ENV_SERVLET_REALPATH, webInfPath + File.separator + "attachments");

    EngineConfiguration config = EngineConfigurationFactoryFinder.newFactory(servlet).getServerEngineConfig();

    if (config != null) {
        environment.put(EngineConfiguration.PROPERTY_NAME, config);
    }

    return environment;
}

From source file:org.dmb.trueprice.utils.internal.InitContextListener.java

public static void getServletConfig(String servletName, HttpServlet servlet) {
    log.warn("\n\t >>> \t Servlet [" + servletName + "] request for config \n");
    log.warn("\n\t >>> \t Can we get it's init param names ? ["
            //                 + servletsContext.getServletRegistration(servletName).getInitParameters().keySet().toString()  + "] "                
            + servletsContext.containsKey(servletName) + "] "

    );/*from  w  w w .  j a v  a2s . c o m*/
    if (servletsContext.containsKey(servletName)) {
        log.debug("\t >>>\t SHOW INIT PARAMS of SERVLET CONTEXT");
        ServletConfig config = servlet.getServletConfig();
        Enumeration<String> e;
        try {
            e = config.getInitParameterNames();
            while (e.hasMoreElements()) {
                String attName = e.nextElement();
                String attValue = servlet.getInitParameter(attName).toString();
                log.info("New init param [" + (attName == null ? "???" : attName) + "] > "
                        + (attValue == null ? "???" : attValue));
            }
        } catch (Exception ex) {
            log.error("\t >>>\t        FAILURE       > " + ex.getMessage());
            ex.printStackTrace();
        }

    }
}

From source file:org.polymap.core.CorePlugin.java

public static String servletAlias(HttpServlet servlet) {
    assert servlet != null;
    String alias = servlet.getInitParameter("alias");
    assert alias != null : "There is no 'alias' init param in this servlet.";
    return alias;
}