当前位置: 首页>>代码示例>>Java>>正文


Java ServletConfig.getInitParameterNames方法代码示例

本文整理汇总了Java中javax.servlet.ServletConfig.getInitParameterNames方法的典型用法代码示例。如果您正苦于以下问题:Java ServletConfig.getInitParameterNames方法的具体用法?Java ServletConfig.getInitParameterNames怎么用?Java ServletConfig.getInitParameterNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.ServletConfig的用法示例。


在下文中一共展示了ServletConfig.getInitParameterNames方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ServletPropertiesMap

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
/**
 * Constructor.
 */
ServletPropertiesMap(ServletConfig config) {
    // This implementation is very simple.
    // It is possible to avoid creation of a new structure, but this would
    // imply writing all of the Map interface.
    Enumeration e = config.getInitParameterNames();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        put(key, config.getInitParameter(key));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:ReloadableDefinitionsFactory.java

示例2: ServletPropertiesMap

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
/**
 * Constructor.
 */
ServletPropertiesMap(ServletConfig config) {
    // This implementation is very simple.
    // It is possible to avoid creation of a new structure, but this need
    // imply writing all Map interface.
    Enumeration e = config.getInitParameterNames();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        put(key, config.getInitParameter(key));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:DefinitionsUtil.java

示例3: readConfigurationProperties

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
protected Map<String, String> readConfigurationProperties(ServletConfig servletConfig) {
  Map<String,String> initParameters = new LinkedHashMap<>();
  Enumeration<String> initParameterNames = servletConfig.getInitParameterNames();
  while (initParameterNames.hasMoreElements()) {
    String initParameterName = initParameterNames.nextElement();
    String initParameterValue = servletConfig.getInitParameter(initParameterName);
    initParameters.put(initParameterName, initParameterValue);
  }
  return initParameters;
}
 
开发者ID:rockscript,项目名称:rockscript,代码行数:11,代码来源:Servlet.java

示例4: init

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
  Info info = new Info()
    .title("Swagger Server")
    .description("Create invoices, check payment and forward coins.")
    .termsOfService("")
    .contact(new Contact()
      .email(""))
    .license(new License()
      .name("")
      .url("http://unlicense.org"));

  ServletContext context = config.getServletContext();
  Swagger swagger = new Swagger().info(info);


  HashMap<String, String> params = new HashMap<>();
  //Build parameter Hashmap
  final Enumeration initParameterNames = config.getInitParameterNames();
  while(initParameterNames.hasMoreElements()){
    Object key = initParameterNames.nextElement();

    if(key instanceof String){
      params.put((String)key,config.getInitParameter((String)key));
    }
  }



  Bitcoin bitcoin = Bitcoin.getInstance();
  bitcoin.addParams(params);
  bitcoin.start();

  new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
}
 
开发者ID:IUNO-TDM,项目名称:PaymentService,代码行数:36,代码来源:Bootstrap.java

示例5: setupFromServletConfig

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
/**
 * Take a DefaultContainer and setup the default beans
 * @param container The container to configure
 * @param servletConfig The servlet configuration (null to ignore)
 * @throws InstantiationException If we can't instantiate a bean
 * @throws IllegalAccessException If we have access problems creating a bean
 */
public static void setupFromServletConfig(DefaultContainer container, ServletConfig servletConfig) throws InstantiationException, IllegalAccessException
{
    Enumeration en = servletConfig.getInitParameterNames();
    while (en.hasMoreElements())
    {
        String name = (String) en.nextElement();
        String value = servletConfig.getInitParameter(name);
        container.addParameter(name, value);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:ContainerUtil.java

示例6: doGet

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
ServletConfig config = getServletConfig();

String lname = config.getServletName();
String driver_Class = config.getInitParameter("driver_Class");
String driver_URL = config.getInitParameter("driver_URL");
String db_User_Name = config.getInitParameter("db_User_Name");
String db_Password = config.getInitParameter("db_Password");
Enumeration<String> e = config.getInitParameterNames();
String param_Names = "";
while(e.hasMoreElements()) {
param_Names = param_Names+e.nextElement()+"<br>";
}

out.println("<html>");
out.println("<body>");
out.println("<h3>Servlet Configuration Details</h3>");
out.println("<table border='1'>");
out.println("<tr><th>Parameter Names</th><th>Parameter Values</th></tr>");
out.println("<tr><td>driver_Class</td><td>"+driver_Class+"</td></tr>");
out.println("<tr><td>driver_URL</td><td>"+driver_URL+"</td></tr>");
out.println("<tr><td>db_User_Name</td><td>"+db_User_Name+"</td></tr>");
out.println("<tr><td>db_Password</td><td>"+db_Password+"</td></tr>");
out.println("<tr><td>Parameter Names</td><td>"+param_Names+"</td></tr>");
out.println("<tr><td>Servlet Logical Name</td><td>"+lname+"</td></tr>");
out.println("</table></body></html>");
}
 
开发者ID:pratikdimble,项目名称:Servlet_Config_Interface,代码行数:30,代码来源:ConfigServlet.java

示例7: getInitParametersInServletConfig

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Map<String, String> getInitParametersInServletConfig(ServletConfig servletConfig) {
    Map<String , String> initParameters = new HashMap<String, String>();
    Enumeration<String> params = servletConfig.getInitParameterNames();
    while (params.hasMoreElements()) {
        String name = params.nextElement();
        String value = servletConfig.getInitParameter(name);
        initParameters.put(name, value);
    }
    return Collections.unmodifiableMap(initParameters);
}
 
开发者ID:devefx,项目名称:validator-web,代码行数:12,代码来源:FakeServletConfig.java

示例8: configureFromInitParams

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
/**
 * Add configurators from init params to the end of the list of
 * configurators.
 * @param container The container to configure
 * @param servletConfig The source of init parameters
 * @return true if any Configurators were read
 * @throws SAXException If the config file parse fails
 * @throws ParserConfigurationException If the config file parse fails
 * @throws IOException If the config file read fails
 */
public static boolean configureFromInitParams(Container container, ServletConfig servletConfig) throws IOException, ParserConfigurationException, SAXException
{
    Enumeration en = servletConfig.getInitParameterNames();
    boolean foundConfig = false;
    while (en.hasMoreElements())
    {
        String name = (String) en.nextElement();
        String value = servletConfig.getInitParameter(name);

        // if the init param starts with "config" then try to load it
        if (name.startsWith(INIT_CONFIG))
        {
            foundConfig = true;

            StringTokenizer st = new StringTokenizer(value, "\n,");
            while (st.hasMoreTokens())
            {
                String fileName = st.nextToken().trim();
                DwrXmlConfigurator local = new DwrXmlConfigurator();
                local.setServletResourceName(fileName);
                local.configure(container);
            }
        }
        else if (name.equals(INIT_CUSTOM_CONFIGURATOR))
        {
            foundConfig = true;

            try
            {
                Configurator configurator = (Configurator) LocalUtil.classNewInstance(INIT_CUSTOM_CONFIGURATOR, value, Configurator.class);
                configurator.configure(container);
                log.debug("Loaded config from: " + value);
            }
            catch (Exception ex)
            {
                log.warn("Failed to start custom configurator", ex);
            }
        }
    }

    return foundConfig;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:53,代码来源:ContainerUtil.java

示例9: init

import javax.servlet.ServletConfig; //导入方法依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws javax.servlet.ServletException {
	super.init(servletConfig);

	if (log.isDebugEnabled()) {
		log.debug("initializing DwrServlet Extension");
	}

	try {
		Enumeration en = servletConfig.getInitParameterNames();
		
		boolean skipDefaultConfig = false;
		
		while (en.hasMoreElements()) {
			
			String paramName = (String) en.nextElement();
			String paramValue = servletConfig.getInitParameter(paramName);

			// meta-config
			if (paramName.startsWith("meta-config") && paramValue != null && !"".equals(paramValue.trim())) {
				PathMatchingResourcePatternResolver resolver = OrderedPathMatchingResourcePatternResolver.getInstance();
				resources = resolver.getResources(paramValue);
			}

			// skipDefaultConfig
			if (paramName.startsWith("skipDefaultConfig") && paramValue != null && !"".equals(paramValue.trim())) {
				skipDefaultConfig = Boolean.parseBoolean(paramValue);
			}
			
		}
		
		/*
		 * Nothing will get loaded into dwr container, since no resources
		 * found in classpath and default config got skipped.
		 */
		if ((resources == null || resources.length == 0) && skipDefaultConfig) {
			throw new IOException(Messages.getString("DwrXmlConfigurator.MissingConfigFile",new String[] { "jar!META-INF/dwr.xml" }));
		}

		/*
		 * When there is no resources found under meta-inf and the
		 * skipDefaultConfig set to false then the validation handled for
		 * default config and the default config will get load into
		 * container by super class.
		 */
		if (resources == null && !skipDefaultConfig) {
			return;
		}
		org.jaffa.dwr.util.ContainerUtil.configureFromResource(getContainer(), servletConfig, resources);
		ContainerUtil.publishContainer(getContainer(), servletConfig);

	} catch (IOException | ParserConfigurationException | SAXException e) {
		throw new ServletException(e);
	}
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:56,代码来源:DwrServlet.java


注:本文中的javax.servlet.ServletConfig.getInitParameterNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。