本文整理汇总了Java中io.vertx.core.http.HttpServerOptions.setCompressionSupported方法的典型用法代码示例。如果您正苦于以下问题:Java HttpServerOptions.setCompressionSupported方法的具体用法?Java HttpServerOptions.setCompressionSupported怎么用?Java HttpServerOptions.setCompressionSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.http.HttpServerOptions
的用法示例。
在下文中一共展示了HttpServerOptions.setCompressionSupported方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configSSL
import io.vertx.core.http.HttpServerOptions; //导入方法依赖的package包/类
private HttpServerOptions configSSL(JsonObject conf) {
String ssl_keystore= conf.getString("ssl.keystore");
String keystore_pass = conf.getString("ssl.keystore.pass");
String ssl_client_keystore= conf.getString("ssl.client.keystore");
String client_keystore_pass = conf.getString("ssl.client.keystore.pass");
HttpServerOptions options = new HttpServerOptions();
options.setCompressionSupported(true);
if(S.isNotBlank(ssl_keystore) && S.isNotBlank(keystore_pass)){
options.setSsl(true).setKeyStoreOptions(
new JksOptions().setPath(ssl_keystore).setPassword(keystore_pass));
if(S.isNotBlank(ssl_client_keystore) && S.isNotBlank(client_keystore_pass))
options.setClientAuth(ClientAuth.REQUIRED).setTrustStoreOptions(
new JksOptions().setPath(ssl_client_keystore).setPassword(client_keystore_pass));
}
return options;
}
示例2: 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);
}
示例3: start
import io.vertx.core.http.HttpServerOptions; //导入方法依赖的package包/类
public void start() throws Exception {
JsonObject conf = vertx.getOrCreateContext().config();
HttpServerOptions options = new HttpServerOptions();
options.setCompressionSupported(true);
HttpServer server = vertx.createHttpServer(options);
/*
<property name="inside.host">172.18.7.20</property>
<property name="inside.port">8999</property>
*/
String host = conf.getString("inside.host");
String port = conf.getString("inside.port");
if(S.isBlank(host) || S.isBlank(port))
return;
// ============初始化======================
this.upload_dir = conf.getString("upload.dir");
this.webclient = WebClient.create(vertx);
this.appContain = gsetting.getAppContain(vertx,this.webclient);
this.initRoutes();
server.requestHandler(router::accept);
server.listen(Integer.parseInt(port), host,ar -> {
if (ar.succeeded()) {
log.info("InsideServer listen on " + port);
} else {
log.error("InsideServer Failed to start!", ar.cause());
}
});
}
示例4: start
import io.vertx.core.http.HttpServerOptions; //导入方法依赖的package包/类
@Before
public void start(TestContext context) {
super.before(context);
Router router = new RestBuilder(vertx)
.register(StaticFileRest.class)
.build();
RestRouter.notFound(router, "rest", RestNotFoundHandler.class);
HttpServerOptions serverOptions = new HttpServerOptions();
serverOptions.setCompressionSupported(true);
vertx.createHttpServer(serverOptions)
.requestHandler(router::accept)
.listen(PORT);
}