本文整理汇总了Java中org.springframework.boot.web.servlet.ServletRegistrationBean.setName方法的典型用法代码示例。如果您正苦于以下问题:Java ServletRegistrationBean.setName方法的具体用法?Java ServletRegistrationBean.setName怎么用?Java ServletRegistrationBean.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.web.servlet.ServletRegistrationBean
的用法示例。
在下文中一共展示了ServletRegistrationBean.setName方法的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;
}
示例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;
}
示例3: jerseyServletRegistration
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean jerseyServletRegistration(
JerseyProperties jerseyProperties, ResourceConfig config) {
ServletRegistrationBean registration = new ServletRegistrationBean(
new ServletContainer(config));
for (Map.Entry<String, String> entry : jerseyProperties.getInit().entrySet()) {
registration.addInitParameter(entry.getKey(), entry.getValue());
}
registration.addUrlMappings("/" +
(StringUtils.isEmpty(lyreProperties.getApplicationPath()) ? "api" : lyreProperties.getApplicationPath())
+ "/*");
registration.setName(APIx.class.getName());
registration.setLoadOnStartup(1);
return registration;
}
示例4: 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;
}
示例5: sessionServletRegistration
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
protected final ServletContextInitializer sessionServletRegistration() {
ServletRegistrationBean bean = new ServletRegistrationBean(new ExampleServlet() {
@Override
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException {
HttpSession session = ((HttpServletRequest) request).getSession(true);
long value = System.currentTimeMillis();
Object existing = session.getAttribute("boot");
session.setAttribute("boot", value);
PrintWriter writer = response.getWriter();
writer.append(String.valueOf(existing) + ":" + value);
}
}, "/session");
bean.setName("session");
return bean;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:AbstractEmbeddedServletContainerFactoryTests.java
示例6: servletRegistrationBean
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean registration = new ServletRegistrationBean(
new HystrixMetricsStreamServlet(), "/hystrix.stream");
registration.setName("hystrixServlet");
registration.setLoadOnStartup(1);
return registration;
}
示例7: 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;
}
示例8: apiServletBean
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean apiServletBean(WebApplicationContext webApplicationContext) {
DispatcherServlet servlet = new DispatcherServlet(webApplicationContext);
ServletRegistrationBean bean = new ServletRegistrationBean(servlet, "/api/*");
bean.setName("ApiServlet");
return bean;
}
示例9: springBatchSupportServlet
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean springBatchSupportServlet() {
AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
applicationContext.register(SpringBatchSupportWebServletConfig.class);
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setApplicationContext(applicationContext);
ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, getServletMapping());
registrationBean.setName(getServletName());
registrationBean.setLoadOnStartup(1);
return registrationBean;
}
示例10: configurationServlet
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean configurationServlet() {
AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
applicationContext.register(ConfigServletConfig.class);
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setApplicationContext(applicationContext);
ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, namicsConfigurationProperties.getWeb()
.getServletMapping());
registrationBean.setName(namicsConfigurationProperties.getWeb().getServletName());
registrationBean.setLoadOnStartup(1);
return registrationBean;
}
开发者ID:namics,项目名称:spring-configuration-support,代码行数:16,代码来源:SpringConfigurationSupportWebAutoConfiguration.java
示例11: alexaServlet
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
/**
* Registers the {@link SpeechletServlet} at the application.
*
* @param speechlet Speechlet.
* @return Registration.
*/
@Bean
public ServletRegistrationBean alexaServlet(WarehouseSpeechlet speechlet) {
SpeechletServlet speechServlet = new SpeechletServlet();
speechServlet.setSpeechlet(speechlet);
ServletRegistrationBean servlet = new ServletRegistrationBean(speechServlet, "/alexa");
servlet.setName("alexa");
return servlet;
}
示例12: i18nSupportServlet
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean i18nSupportServlet() {
AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
applicationContext.register(I18nWebConfig.class);
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setApplicationContext(applicationContext);
ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, getServletMapping());
registrationBean.setName(getServletName());
registrationBean.setLoadOnStartup(1);
return registrationBean;
}
示例13: dispatcherServletRegistration
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
final ServletRegistrationBean registration = new ServletRegistrationBean(
dispatcherServlet(),
"/" + this.pathPrefix + "/*"
);
registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
return registration;
}
示例14: dispatcherRegistration
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet){
ServletRegistrationBean bean =
new ServletRegistrationBean(dispatcherServlet, "/restapi/*");
bean.setAsyncSupported(true);
bean.setName("catgenome");
bean.setLoadOnStartup(1);
return bean;
}
示例15: oauth
import org.springframework.boot.web.servlet.ServletRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletRegistrationBean oauth() {
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setApplicationContext(applicationContext);
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(dispatcherServlet,
"/oauth/token");
servletRegistrationBean.setName("oauth");
servletRegistrationBean.setLoadOnStartup(1);
return servletRegistrationBean;
}