本文整理汇总了Java中io.undertow.Undertow.Builder.addAjpListener方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.addAjpListener方法的具体用法?Java Builder.addAjpListener怎么用?Java Builder.addAjpListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.undertow.Undertow.Builder
的用法示例。
在下文中一共展示了Builder.addAjpListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableAJP
import io.undertow.Undertow.Builder; //导入方法依赖的package包/类
private static void enableAJP(Config undertowConf, Builder undertowBuilder, Logger logger) {
if (Boolean.getBoolean(SYS_PROP_ENABLE_AJP)) {
Config ajpConf = undertowConf.getConfig(KEY_AJP);
int ajpPort = ajpConf.getInt(KEY_PORT);
undertowBuilder.addAjpListener(ajpPort, ajpConf.getString(KEY_HOST));
logger.info("AJP enabled @ port: [{}]", ajpPort);
}
}
示例2: createServer
import io.undertow.Undertow.Builder; //导入方法依赖的package包/类
protected io.undertow.Undertow createServer(HttpHandler contextHandler) {
int ports = settings.getHttpPort() + settings.getHttpsPort() + settings.getAjpPort();
Preconditions.checkState(ports > 0, "No port specified! Please review your server port settings!");
log.debug("Configuring Undertow engine");
Builder builder = io.undertow.Undertow.builder();
if (settings.getHttpPort() > 0) {
// HTTP
builder.addHttpListener(settings.getHttpPort(), settings.getHttpListenAddress());
logSetting(Settings.Setting.undertow_httpPort, settings.getHttpPort());
}
if (settings.getHttpsPort() > 0) {
// HTTPS
builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true);
try {
KeyStore keyStore = loadKeyStore(settings.getKeystoreFile(), settings.getKeystorePassword());
KeyStore trustStore = loadKeyStore(settings.getTruststoreFile(), settings.getTruststorePassword());
SSLContext sslContext = createSSLContext(keyStore, trustStore);
builder.addHttpsListener(settings.getHttpsPort(), settings.getHttpsListenAddress(), sslContext);
logSetting(Settings.Setting.undertow_httpsPort, settings.getHttpsPort());
} catch (Exception e) {
throw new FathomException(e, "Failed to setup an Undertow SSL listener!");
}
}
if (settings.getAjpPort() > 0) {
// AJP
builder.addAjpListener(settings.getAjpPort(), settings.getAjpListenAddress());
logSetting(Settings.Setting.undertow_ajpPort, settings.getAjpPort());
}
int ioThreads = settings.getInteger(Settings.Setting.undertow_ioThreads, 0);
if (ioThreads > 0) {
builder.setIoThreads(ioThreads);
logSetting(Settings.Setting.undertow_ioThreads, ioThreads);
}
int workerThreads = settings.getInteger(Settings.Setting.undertow_workerThreads, 0);
if (workerThreads > 0) {
builder.setWorkerThreads(workerThreads);
logSetting(Settings.Setting.undertow_workerThreads, workerThreads);
}
long bufferSize = settings.getBytes(Settings.Setting.undertow_bufferSize, null);
if (bufferSize > 0) {
builder.setBufferSize((int) bufferSize);
logSetting(Settings.Setting.undertow_bufferSize, bufferSize);
}
builder.setHandler(contextHandler);
io.undertow.Undertow server = builder.build();
return server;
}
示例3: prepareUndertow
import io.undertow.Undertow.Builder; //导入方法依赖的package包/类
private static void prepareUndertow() {
if (!error) {
Config config = injector.getInstance(Config.class);
HttpHandler httpHandler;
if (config.isMetricsEnabled()) {
httpHandler = MetricsHandler.HANDLER_WRAPPER.wrap(Handlers.exceptionHandler(pathHandler)
.addExceptionHandler(Throwable.class, Application.getInstance(ExceptionHandler.class)));
} else {
httpHandler = Handlers.exceptionHandler(pathHandler)
.addExceptionHandler(Throwable.class, Application.getInstance(ExceptionHandler.class));
}
Builder builder = Undertow.builder()
.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, config.getUndertowMaxEntitySize())
.setHandler(httpHandler);
httpHost = config.getConnectorHttpHost();
httpPort = config.getConnectorHttpPort();
ajpHost = config.getConnectorAjpHost();
ajpPort = config.getConnectorAjpPort();
boolean hasConnector = false;
if (httpPort > 0 && StringUtils.isNotBlank(httpHost)) {
builder.addHttpListener(httpPort, httpHost);
hasConnector = true;
}
if (ajpPort > 0 && StringUtils.isNotBlank(ajpHost)) {
builder.addAjpListener(ajpPort, ajpHost);
hasConnector = true;
}
if (hasConnector) {
undertow = builder.build();
undertow.start();
} else {
LOG.error("No connector found! Please configure a HTTP and/or AJP connector in your application.yaml");
error = true;
}
}
}