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