本文整理汇总了Java中io.vertx.core.http.HttpServerOptions.setPort方法的典型用法代码示例。如果您正苦于以下问题:Java HttpServerOptions.setPort方法的具体用法?Java HttpServerOptions.setPort怎么用?Java HttpServerOptions.setPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.http.HttpServerOptions
的用法示例。
在下文中一共展示了HttpServerOptions.setPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import io.vertx.core.http.HttpServerOptions; //导入方法依赖的package包/类
@Override
public void start() throws Exception {
final Router router = Router.router(vertx);
final HttpServerOptions httpServerOptions = new HttpServerOptions();
httpServerOptions.setPort(8900);
final HttpServer http = vertx.createHttpServer(httpServerOptions);
SwaggerHandler.registerToRouter(router, MyApp.class);
final JaxRsRouter jaxRsRouter = new JaxRsRouter();
final SpringJaxRsHandler handler = new SpringJaxRsHandler(MyApp.class);
jaxRsRouter.register(MyApp.class, router, handler, handler);
ManifestHandler.registerToRouter(router);
http.requestHandler(req -> router.accept(req)).listen(res -> {
if (res.failed()) {
res.cause().printStackTrace();
vertx.close();
}
});
}
示例2: createOptions
import io.vertx.core.http.HttpServerOptions; //导入方法依赖的package包/类
private HttpServerOptions createOptions() {
Integer port = applicationConfiguration.getHttpPort();
logger.info("Starting HTTP server on port: {}", port);
HttpServerOptions options = new HttpServerOptions();
options.setLogActivity(true);
options.setHost("localhost");
options.setPort(port);
return options;
}
示例3: configureHttpServer
import io.vertx.core.http.HttpServerOptions; //导入方法依赖的package包/类
private void configureHttpServer(VertxContext vertxContext, Future<HttpServerOptions> future) {
HttpServerOptions httpServerOptions = new HttpServerOptions();
httpServerOptions.setPort(vertxContext.config().getInteger(HTTP_PORT_KEY, DEFAULT_PORT));
ServiceLoader<HttpServerConfigurator> configurators = ServiceLoader.load(HttpServerConfigurator.class);
configurators.forEach(c -> c.configureHttpServer(vertxContext, httpServerOptions));
httpServerOptions.setCompressionSupported(true);
future.complete(httpServerOptions);
}