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


Java ServletRegistrationBean.setInitParameters方法代码示例

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


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

示例1: registerProxyServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
/**
 * Configures a custom jetty http proxy servlet based on <b>oneops.proxy.enabled</b>
 * config property. The proxy configuration is done on the <b>application.yaml</b> file.
 *
 * @param config OneOps config
 * @return {@link ServletRegistrationBean}
 */
@Bean
@ConditionalOnProperty("oneops.proxy.enabled")
public ServletRegistrationBean registerProxyServlet(OneOpsConfig config) {
    log.info("OneOps Http Proxy is enabled.");
    OneOpsConfig.Proxy proxyCfg = config.getProxy();

    Map<String, String> initParams = new HashMap<>();
    initParams.put(proxyTo.name(), proxyCfg.getProxyTo());
    initParams.put(prefix.name(), proxyCfg.getPrefix());
    initParams.put(viaHost.name(), proxyCfg.getViaHost());
    initParams.put(trustAll.name(), String.valueOf(proxyCfg.isTrustAll()));
    initParams.put(xAuthHeader.name(), config.getAuth().getHeader());

    ServletRegistrationBean servletBean = new ServletRegistrationBean(new ProxyServlet(), proxyCfg.getPrefix() + "/*");
    servletBean.setName("OneOps Proxy Servlet");
    servletBean.setInitParameters(initParams);
    servletBean.setAsyncSupported(true);
    log.info("Configured OneOps proxy servlet with mapping: " + proxyCfg.getPrefix());
    return servletBean;
}
 
开发者ID:oneops,项目名称:secrets-proxy,代码行数:28,代码来源:EmbeddedServerConfig.java

示例2: druidStatViewServletBean

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidStatViewServletBean() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), env.getProperty("druid.urlMapper"));
    Map<String,String> params = new HashMap<>();
    params.put("loginUsername",env.getProperty("druid.loginUsername"));
    params.put("loginPassword",env.getProperty("druid.loginPassword"));
    params.put("resetEnable",env.getProperty("druid.resetEnable"));
    servletRegistrationBean.setInitParameters(params);
    return servletRegistrationBean;
}
 
开发者ID:myopenresources,项目名称:cc-s,代码行数:11,代码来源:DruidServletConfig.java

示例3: servletRegistrationBean

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
/**
 * Spring Servlet Registration bean for StatusServlet.
 * 
 * @return ServletRegistrationBean
 */
public ServletRegistrationBean servletRegistrationBean() {
    Map<String, String> initParameters = new HashMap<>();
    initParameters.put("bean", AppStatusWebConstants.BEAN_NAME);
    initParameters.put("custom-pages", customPages);

    ServletRegistrationBean srb = new ServletRegistrationBean();
    srb.setServlet(new StatusServlet());
    srb.setUrlMappings(urlMappings);
    srb.setInitParameters(initParameters);

    return srb;
}
 
开发者ID:appstatus,项目名称:appstatus-spring-boot-starter,代码行数:18,代码来源:AppStatusServletBuilder.java

示例4: servletRegistration

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
ServletRegistrationBean servletRegistration(DruidStatProperties druidStatConfig) {
	ServletRegistrationBean filterRegistration = new ServletRegistrationBean(new StatViewServlet());
	filterRegistration.setAsyncSupported(true);
	filterRegistration.setEnabled(true);
	filterRegistration.addUrlMappings("/druid/*");
	filterRegistration.setInitParameters(druidStatParameters(druidStatConfig));
	return filterRegistration;
}
 
开发者ID:halober,项目名称:spring-boot-starter-dao,代码行数:10,代码来源:DruidWebStatAutoConfiguration.java

示例5: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    Map<String, String> initParameters = new HashMap<String, String>();
    // initParameters.put("loginUsername", "druid");// 用户名
    // initParameters.put("loginPassword", "druid");// 密码
    initParameters.put("resetEnable", "false");// 禁用HTML页面上的“Reset All”功能
    initParameters.put("allow", "127.0.0.1"); // IP白名单 (没有配置或者为空,则允许所有访问)
    // initParameters.put("deny", "192.168.20.38");// IP黑名单
    // (存在共同时,deny优先于allow)
    servletRegistrationBean.setInitParameters(initParameters);
    return servletRegistrationBean;
}
 
开发者ID:egojit8,项目名称:easyweb,代码行数:16,代码来源:DruidDataSourceConfig.java

示例6: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet() {
    LOGGER.info("Initializing DruidServlet Config");
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    Map<String, String> initParameters = new HashMap();
    initParameters.put("loginUsername", "admin");// 用户名
    initParameters.put("loginPassword", "[email protected]!");// 密码
    initParameters.put("resetEnable", "false");// 禁用HTML页面上的“Reset All”功能
    initParameters.put("allow", ""); // IP白名单 (没有配置或者为空,则允许所有访问)
    //initParameters.put("deny", "192.168.20.38");// IP黑名单 (存在共同时,deny优先于allow)
    servletRegistrationBean.setInitParameters(initParameters);
    return servletRegistrationBean;
}
 
开发者ID:lupindong,项目名称:xq_seckill_microservice,代码行数:16,代码来源:DataSourceConfig.java

示例7: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet(){
    log.info("init Druid Servlet Configuration ");
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    Map<String, String> initParameters = new HashMap<String, String>();
    initParameters.put("loginUsername", "admin");// 用户名
    initParameters.put("loginPassword", "admin");// 密码
    initParameters.put("resetEnable", "false");// 禁用HTML页面上的“Reset All”功能
    initParameters.put("allow", ""); // IP白名单 (没有配置或者为空,则允许所有访问)
    //initParameters.put("deny", "192.168.20.38");// IP黑名单 (存在共同时,deny优先于allow)
    servletRegistrationBean.setInitParameters(initParameters);
    return servletRegistrationBean;
}
 
开发者ID:nellochen,项目名称:springboot-start,代码行数:16,代码来源:DruidConfig.java


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