本文整理汇总了Java中io.advantageous.qbit.http.config.HttpServerConfig类的典型用法代码示例。如果您正苦于以下问题:Java HttpServerConfig类的具体用法?Java HttpServerConfig怎么用?Java HttpServerConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpServerConfig类属于io.advantageous.qbit.http.config包,在下文中一共展示了HttpServerConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHttpServerAndRoutes
import io.advantageous.qbit.http.config.HttpServerConfig; //导入依赖的package包/类
private HttpServer getHttpServerAndRoutes(final io.vertx.core.http.HttpServer vertxHttpServer, final Router router) {
/* Route everything under /v1 to QBit http server. */
final Route qbitRoute = router.route().path("/v1/*");
/*
* Use the VertxHttpServerBuilder which is a special builder for Vertx/Qbit integration.
*/
return VertxHttpServerBuilder.vertxHttpServerBuilder()
.setRoute(qbitRoute)
.setHttpServer(vertxHttpServer)
.setVertx(getVertx())
.setConfig(new HttpServerConfig()) //not needed in master branch of qbit workaround for bug
.build();
}
示例2: start
import io.advantageous.qbit.http.config.HttpServerConfig; //导入依赖的package包/类
@Override
public void start() throws Exception {
managedServiceBuilder.setRootURI("/v1");
managedServiceBuilder.enableRequestChain();
final Vertx vertx = getVertx();
/* Vertx HTTP Server. */
final io.vertx.core.http.HttpServer vertxHttpServer =
vertx.createHttpServer();
/* Route one call to a vertx handler. */
final Router router = Router.router(vertx); //Vertx router
/* Route everything under /v1 to QBit http server. */
final Route qbitRoute = router.route().path("/v1/*");
/*
* Use the VertxHttpServerBuilder which is a special builder for Vertx/Qbit integration.
*/
VertxHttpServerBuilder vertxHttpServerBuilder = VertxHttpServerBuilder.vertxHttpServerBuilder();
final HttpServer httpServer= vertxHttpServerBuilder
.setRoute(qbitRoute)
.setHttpServer(vertxHttpServer)
.setVertx(vertx)
.setConfig(new HttpServerConfig())
.build();
vertxHttpServerBuilder.addShouldContinueHttpRequestPredicate(request -> {
System.out.println("BODY " + request.getBodyAsString());
System.out.println("FORM PARAMS " + request.getFormParams());
return true;
} );
managedServiceBuilder.addEndpointService(new FormSubmit());
/*
* Create and start new service endpointServer.
*/
managedServiceBuilder.getEndpointServerBuilder()
.setHttpServer(httpServer)
.build()
.startServer();
/*
* Associate the router as a request handler for the vertxHttpServer.
*/
vertxHttpServer.requestHandler(router::accept).listen(
managedServiceBuilder.getPort());
}
示例3: setHttpServerConfig
import io.advantageous.qbit.http.config.HttpServerConfig; //导入依赖的package包/类
public HttpServerBuilder setHttpServerConfig(HttpServerConfig httpServerConfig) {
this.httpServerConfig = httpServerConfig;
return this;
}
示例4: setConfig
import io.advantageous.qbit.http.config.HttpServerConfig; //导入依赖的package包/类
public HttpServerBuilder setConfig(HttpServerConfig config) {
this.httpServerConfig = config;
return this;
}
示例5: withConfig
import io.advantageous.qbit.http.config.HttpServerConfig; //导入依赖的package包/类
public HttpServerBuilder withConfig(Consumer<HttpServerConfig> config) {
config.accept(this.httpServerConfig);
return this;
}