Java 类org.springframework.http.server.reactive.HttpHandler 实例源码

项目:spring-reactive-sample    文件:Application.java   
@Bean
public Server jettyServer(ApplicationContext context) throws Exception {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    Servlet servlet = new JettyHttpHandlerAdapter(handler);

    Server server = new Server();
    ServletContextHandler contextHandler = new ServletContextHandler(server, "");
    contextHandler.addServlet(new ServletHolder(servlet), "/");
    contextHandler.start();

    ServerConnector connector = new ServerConnector(server);
    connector.setHost("localhost");
    connector.setPort(port);
    server.addConnector(connector);

    return server;
}
项目:spring-reactive-sample    文件:Application.java   
@Bean
public Tomcat embededTomcatServer(ApplicationContext context) throws Exception {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build(); 

    // Tomcat and Jetty (also see notes below)
    Servlet servlet = new TomcatHttpHandlerAdapter(handler);

    Tomcat tomcatServer = new Tomcat();
    tomcatServer.setHostname("localhost");
    tomcatServer.setPort(this.port);
    Context rootContext = tomcatServer.addContext("", System.getProperty("java.io.tmpdir"));
    Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet);
    rootContext.addServletMappingDecoded("/", "httpHandlerServlet");

    return tomcatServer;
}
项目:spring-webflux-microservices-boilerplate    文件:Application.java   
@Bean public HttpHandler handler() {
    return WebHttpHandlerBuilder
        .webHandler((WebHandler) toHttpHandler(routing()))
        .filter(limitFilter)
//        .filter(validateFilter)
        .build();
  }
项目:spring-webflux-microservices-boilerplate    文件:HttpServerConfig.java   
@Bean public HttpServer httpServer(RouterFunction<?> routerFunction) {
  HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction);
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
  HttpServer server = HttpServer
      .create(serverConfigBean.getAddress(), serverConfigBean.getPort());
  server.newHandler(adapter);
  return server;
}
项目:spring5demo    文件:ReactorApplication.java   
private void startReactorServer() {
    RouterFunction<?> route = routingFunction();
    HttpHandler httpHandler = toHttpHandler(route);

    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
    HttpServer server = HttpServer.create(HOST, PORT);
    server.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8095"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8908"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8901"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9007"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9006"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8901"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8909"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8125"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9008"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8901"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8095"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9008"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8908"));
    return httpServer.newHandler(adapter).block();
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);

    System.out.println("starts server");        
     return registrationBean;
 }
项目:reactive.loanbroker.system    文件:Application.java   
@Bean
public HttpServer reactorServer(){
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create(port);
    httpServer.newHandler(adapter).block();
    return httpServer;
}
项目:reactive.loanbroker.system    文件:Application.java   
@Bean
public HttpServer reactorServer(){
    HttpHandler handler = routingHandler();
    //HttpHandler handler = dispatcherHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create(port);
    httpServer.newHandler(adapter).block();
    return httpServer;
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}