Search in sources :

Example 11 with ServletRegistrationBean

use of org.springframework.boot.web.servlet.ServletRegistrationBean in project ocvn by devgateway.

the class JMXConfiguration method jminiXServletRegistration.

@Bean
public ServletRegistrationBean jminiXServletRegistration(final MiniConsoleApplication miniConsoleApplication) {
    ServletRegistrationBean registration = new ServletRegistrationBean(new SpringMiniConsoleServlet());
    registration.addUrlMappings("/jminix/*");
    return registration;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) SpringMiniConsoleServlet(org.jminix.console.servlet.SpringMiniConsoleServlet) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 12 with ServletRegistrationBean

use of org.springframework.boot.web.servlet.ServletRegistrationBean in project camel by apache.

the class ServletMappingAutoConfiguration method servletRegistrationBean.

@Bean
ServletRegistrationBean servletRegistrationBean(ServletMappingConfiguration config) {
    ServletRegistrationBean mapping = new ServletRegistrationBean();
    mapping.setServlet(new CamelHttpTransportServlet());
    mapping.addUrlMappings(config.getContextPath());
    mapping.setName(config.getServletName());
    mapping.setLoadOnStartup(1);
    return mapping;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) CamelHttpTransportServlet(org.apache.camel.component.servlet.CamelHttpTransportServlet) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 13 with ServletRegistrationBean

use of org.springframework.boot.web.servlet.ServletRegistrationBean in project camel by apache.

the class Application method camelServletRegistrationBean.

@Bean
public ServletRegistrationBean camelServletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), "/camel/*");
    registration.setName("CamelServlet");
    return registration;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) CamelHttpTransportServlet(org.apache.camel.component.servlet.CamelHttpTransportServlet) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 14 with ServletRegistrationBean

use of org.springframework.boot.web.servlet.ServletRegistrationBean in project cas by apereo.

the class CoreWsSecuritySecurityTokenServiceConfiguration method cxfServlet.

@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;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) CXFServlet(org.apache.cxf.transport.servlet.CXFServlet) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) STSPropertiesMBean(org.apache.cxf.sts.STSPropertiesMBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 15 with ServletRegistrationBean

use of org.springframework.boot.web.servlet.ServletRegistrationBean in project spring-boot by spring-projects.

the class UndertowServletWebServerFactoryTests method testAccessLog.

private void testAccessLog(String prefix, String suffix, String expectedFile) throws IOException, URISyntaxException, InterruptedException {
    UndertowServletWebServerFactory factory = getFactory();
    factory.setAccessLogEnabled(true);
    factory.setAccessLogPrefix(prefix);
    factory.setAccessLogSuffix(suffix);
    File accessLogDirectory = this.temporaryFolder.getRoot();
    factory.setAccessLogDirectory(accessLogDirectory);
    assertThat(accessLogDirectory.listFiles()).isEmpty();
    this.webServer = factory.getWebServer(new ServletRegistrationBean<>(new ExampleServlet(), "/hello"));
    this.webServer.start();
    assertThat(getResponse(getLocalUrl("/hello"))).isEqualTo("Hello World");
    File accessLog = new File(accessLogDirectory, expectedFile);
    awaitFile(accessLog);
    assertThat(accessLogDirectory.listFiles()).contains(accessLog);
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) File(java.io.File) ExampleServlet(org.springframework.boot.web.servlet.server.ExampleServlet)

Aggregations

ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)25 Bean (org.springframework.context.annotation.Bean)14 Test (org.junit.Test)8 HttpComponentsClientHttpRequestFactory (org.springframework.http.client.HttpComponentsClientHttpRequestFactory)7 HttpClient (org.apache.http.client.HttpClient)6 SSLConnectionSocketFactory (org.apache.http.conn.ssl.SSLConnectionSocketFactory)6 SSLContextBuilder (org.apache.http.ssl.SSLContextBuilder)6 TrustSelfSignedStrategy (org.apache.http.conn.ssl.TrustSelfSignedStrategy)5 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)4 CamelHttpTransportServlet (org.apache.camel.component.servlet.CamelHttpTransportServlet)3 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)3 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)3 IOException (java.io.IOException)2 ServletException (javax.servlet.ServletException)2 HttpServlet (javax.servlet.http.HttpServlet)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 Compression (org.springframework.boot.web.server.Compression)2 AbstractServletWebServerFactory (org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory)2 ExampleServlet (org.springframework.boot.web.servlet.server.ExampleServlet)2