org.springframework.http.server.reactive.TomcatHttpHandlerAdapter Java Examples

The following examples show how to use org.springframework.http.server.reactive.TomcatHttpHandlerAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 6 votes vote down vote up
@Bean
@Profile("default")
public Tomcat embeddedTomcatServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();

    Servlet servlet = new TomcatHttpHandlerAdapter(handler);
    Tomcat tomcat = new Tomcat();

    File base = new File(System.getProperty("java.io.tmpdir"));
    Context rootContext = tomcat.addContext("", base.getAbsolutePath());
    Tomcat.addServlet(rootContext, "main", servlet).setAsyncSupported(true);
    rootContext.addServletMappingDecoded("/", "main");

    tomcat.setHostname("localhost");
    tomcat.setPort(this.port);
    tomcat.setBaseDir(System.getProperty("java.io.tmpdir"));

    return tomcat;
}
 
Example #2
Source File: TomcatHttpServer.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private ServletHttpHandlerAdapter initServletAdapter() {
	return new TomcatHttpHandlerAdapter(resolveHttpHandler());
}
 
Example #3
Source File: TomcatHttpServer.java    From java-technology-stack with MIT License 4 votes vote down vote up
private ServletHttpHandlerAdapter initServletAdapter() {
	return new TomcatHttpHandlerAdapter(resolveHttpHandler());
}