當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。