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


Java ServletRegistrationBean.setServlet方法代码示例

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


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

示例1: camelServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
ServletRegistrationBean camelServlet() {
    // use a @Bean to register the Camel servlet which we need to do
    // because we want to use the camel-servlet component for the Camel REST service
    ServletRegistrationBean mapping = new ServletRegistrationBean();
    mapping.setName("CamelServlet");
    mapping.setLoadOnStartup(1);
    mapping.setServlet(new CamelHttpTransportServlet());
    mapping.addUrlMappings("/camel/*");
    return mapping;
}
 
开发者ID:funktionio,项目名称:funktion-connectors,代码行数:12,代码来源:FunktionRouteBuilder.java

示例2: camelServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
ServletRegistrationBean camelServlet() {
    // TODO: Camel 2.19 should support this OOTB
    // use a @Bean to register the Camel servlet which we need to do
    // because we want to use the camel-servlet component for the Camel REST service
    ServletRegistrationBean mapping = new ServletRegistrationBean();
    mapping.setName("CamelServlet");
    mapping.setLoadOnStartup(1);
    // CamelHttpTransportServlet is the name of the Camel servlet to use
    mapping.setServlet(new CamelHttpTransportServlet());
    mapping.addUrlMappings("/api/*");
    return mapping;
}
 
开发者ID:abouchama,项目名称:camel-springboot-rest-ose,代码行数:14,代码来源:route.java

示例3: servletRegistrationBean

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
/**
 * Druid 提供了一个 StatViewServlet 用于展示 Druid 的统计信息
 * 这个 StatViewServlet 的用途包括:
 *   1. 提供监控信息展示的 HTML 页面
 *   2. 提供监控信息的 JSON API
 */
@Bean
public ServletRegistrationBean servletRegistrationBean(DruidDataSourceProperties druidDataSourceProperties) {
    log.debug("druid stat-view-servlet init...");
    DruidStatViewServletProperties properties = druidDataSourceProperties.getStatViewServlet();
    ServletRegistrationBean registration = new ServletRegistrationBean();
    StatViewServlet statViewServlet = new StatViewServlet();
    registration.setServlet(statViewServlet);
    registration.addUrlMappings(properties.getUrlMappings());
    if (!StringUtils.isEmpty(properties.getLoginUsername())) {
        registration.addInitParameter("loginUsername", properties.getLoginUsername());
    }
    if (!StringUtils.isEmpty(properties.getLoginPassword())) {
        registration.addInitParameter("loginPassword", properties.getLoginPassword());
    }
    if (!StringUtils.isEmpty(properties.getAllow())) {
        registration.addInitParameter("allow", properties.getAllow());
    }
    if (!StringUtils.isEmpty(properties.getDeny())) {
        registration.addInitParameter("deny", properties.getDeny());
    }
    registration.addInitParameter("resetEnable", Boolean.toString(properties.isResetEnable()));
    return registration;
}
 
开发者ID:drtrang,项目名称:druid-spring-boot,代码行数:30,代码来源:DruidServletConfiguration.java

示例4: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
@ConfigurationProperties(DruidServletProperties.DRUID_SERVLET_PREFIX)
public ServletRegistrationBean druidServlet(DruidServletProperties properties) {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings(properties.getUrlMappings());
    if(properties.getAllow() !=null){
        reg.addInitParameter("allow", properties.getAllow());  // IP白名单 (没有配置或者为空,则允许所有访问)
    }
    if(properties.getDeny() !=null){
        reg.addInitParameter("deny", properties.getDeny()); //IP黑名单 (存在共同时,deny优先于allow)
    }
    if(properties.getLoginUsername() !=null){
        reg.addInitParameter("loginUsername", properties.getLoginUsername()); //用户名
    }
    if(properties.getLoginPassword() !=null){
        reg.addInitParameter("loginPassword", properties.getLoginPassword()); // 密码
    }
    if(properties.getResetEnable() !=null){
        reg.addInitParameter("resetEnable", properties.getResetEnable().toString());// 禁用HTML页面上的“Reset All”功能
    }
    return reg;
}
 
开发者ID:cuisongliu,项目名称:druid-boot-starter,代码行数:24,代码来源:DruidServletAutoConfiguration.java

示例5: cxfServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean cxfServlet() {
    final ServletRegistrationBean bean = new ServletRegistrationBean();
    bean.setEnabled(true);
    bean.setName("cxfServletSecurityTokenService");
    bean.setServlet(new CXFServlet());
    bean.setUrlMappings(Collections.singleton(WSFederationConstants.ENDPOINT_STS.concat("*")));
    bean.setAsyncSupported(true);
    return bean;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:11,代码来源:CoreWsSecuritySecurityTokenServiceConfiguration.java

示例6: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
    public ServletRegistrationBean druidServlet() {
        ServletRegistrationBean reg = new ServletRegistrationBean();
        reg.setServlet(new StatViewServlet());
        reg.addUrlMappings("/druid/*");
        reg.addInitParameter("allow", "127.0.0.1");//允许访问地址,不填则全允许,填了只允许
//        reg.addInitParameter("deny", "127.0.0.1");
        reg.addInitParameter("loginUsername", dbConfigProperties.getDruidVisitName());
        reg.addInitParameter("loginPassword", dbConfigProperties.getDruidVisitPwd());
        return reg;
    }
 
开发者ID:DomKing,项目名称:busi-support,代码行数:12,代码来源:DruidConfig.java

示例7: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    return servletRegistrationBean;
}
 
开发者ID:zhaoqicheng,项目名称:renren-fast,代码行数:8,代码来源:DruidConfig.java

示例8: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet() {
	ServletRegistrationBean reg = new ServletRegistrationBean();
	reg.setServlet(new StatViewServlet());
	reg.addUrlMappings("/druid/*");
	reg.addInitParameter("loginUsername", "admin");
	reg.addInitParameter("loginPassword", "admin123");
	return reg;
}
 
开发者ID:cairenjie1985,项目名称:springBoot-demo,代码行数:10,代码来源:SpringBootDemoApplication.java

示例9: 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

示例10: registration

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean registration(HystrixMetricsStreamServlet servlet) {
    ServletRegistrationBean registrationBean = new ServletRegistrationBean();
    registrationBean.setServlet(servlet);
    registrationBean.setEnabled(true);
    registrationBean.addUrlMappings("/hystrix.stream");
    return registrationBean;
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:9,代码来源:MonitorAutoconfiguration.java

示例11: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings("/druid/*");
    reg.addInitParameter("loginUsername", "admin");
    reg.addInitParameter("loginPassword", "admin");
    reg.addInitParameter("resetEnable", "false");// 禁用HTML页面上的“Reset All”功能
    //reg.addInitParameter("allow", "127.0.0.1");// IP白名单 (没有配置或者为空,则允许所有访问)
    //reg.addInitParameter("deny","");// IP黑名单 (存在共同时,deny优先于allow)
    return reg;
}
 
开发者ID:openmg,项目名称:metagraph-auth,代码行数:13,代码来源:DatabaseConfigurer.java

示例12: druidServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings("/druid/*");
    //reg.addInitParameter("allow", "127.0.0.1");
    //reg.addInitParameter("deny","");
    reg.addInitParameter("loginUsername", "admin");
    reg.addInitParameter("loginPassword", "admin");
    return reg;
}
 
开发者ID:xiaomoinfo,项目名称:order,代码行数:12,代码来源:DruidConfig.java

示例13: 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

示例14: 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

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