當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpServerBuilder類代碼示例

本文整理匯總了Java中io.reactivex.netty.protocol.http.server.HttpServerBuilder的典型用法代碼示例。如果您正苦於以下問題:Java HttpServerBuilder類的具體用法?Java HttpServerBuilder怎麽用?Java HttpServerBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HttpServerBuilder類屬於io.reactivex.netty.protocol.http.server包,在下文中一共展示了HttpServerBuilder類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createServer

import io.reactivex.netty.protocol.http.server.HttpServerBuilder; //導入依賴的package包/類
private HttpServer<ByteBuf, ByteBuf> createServer(final int listenPort) {
	HttpServer<ByteBuf, ByteBuf> server = new HttpServerBuilder<ByteBuf, ByteBuf>(listenPort, (
			request, response) -> request
			.getContent()
			.compose(new RequestTransformer())
			.filter(bidreq -> bidreq != null)
			.compose(new ExternalRequestTransformer())
			.compose(new ExternalRequestExecutor(client))
			.flatMap(
					resp -> {
						response.setStatus(resp == null ? HttpResponseStatus.NO_CONTENT
								: HttpResponseStatus.OK);
						response.writeString(resp == null ? "" : resp.toString());
						return response.close();
					})).build();
	LOG.info("Gateway started...");
	return server;
}
 
開發者ID:rotemfogel,項目名稱:RxNettyProxy,代碼行數:19,代碼來源:ProxyServer.java

示例2: init

import io.reactivex.netty.protocol.http.server.HttpServerBuilder; //導入依賴的package包/類
@BeforeClass
public static void init() {
    port = new Random().nextInt(1000) + 4000;
    HttpServerBuilder<ByteBuf, ByteBuf> builder 
        = new HttpServerBuilder<ByteBuf, ByteBuf>(new ServerBootstrap().group(new NioEventLoopGroup(10, new RxServerThreadFactory())), port, new RequestProcessor());
    server = builder.build();
    // server = RxNetty.createHttpServer(port, new RequestProcessor());
    
    server.start();
}
 
開發者ID:allenxwang,項目名稱:RxNetty,代碼行數:11,代碼來源:HttpClientTest.java

示例3: setInjector

import io.reactivex.netty.protocol.http.server.HttpServerBuilder; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
@Inject
public void setInjector(Injector injector) {
    HttpServerConfig config = (HttpServerConfig) injector.getInstance(serverConfigKey);

    RequestHandler router = injector.getInstance(routerKey);

    GovernatorHttpInterceptorSupport<I, O> interceptorSupport = injector.getInstance(interceptorSupportKey);
    interceptorSupport.finish(injector);
    HttpRequestHandler<I, O> httpRequestHandler = new HttpRequestHandler<I, O>(router, interceptorSupport);

    HttpServerBuilder<I, O> builder = KaryonTransport.newHttpServerBuilder(config.getPort(), httpRequestHandler);

    if (config.requiresThreadPool()) {
        builder.withRequestProcessingThreads(config.getThreadPoolSize());
    }

    if (injector.getExistingBinding(pipelineConfiguratorKey) != null) {
        builder.appendPipelineConfigurator(injector.getInstance(pipelineConfiguratorKey));
    }

    if (injector.getExistingBinding(metricEventsListenerFactoryKey) != null) {
        builder.withMetricEventsListenerFactory(injector.getInstance(metricEventsListenerFactoryKey));
    }

    httpServer = builder.build().start();
    logger.info("Starting server {} on port {}...", nameAnnotation.value(), httpServer.getServerPort());
}
 
開發者ID:Netflix,項目名稱:karyon,代碼行數:29,代碼來源:HttpRxServerProvider.java

示例4: createHttpServer

import io.reactivex.netty.protocol.http.server.HttpServerBuilder; //導入依賴的package包/類
public static HttpServer<ByteBuf, ByteBuf> createHttpServer(int port, RequestHandler<ByteBuf, ByteBuf> requestHandler) {
    return new HttpServerBuilder<ByteBuf, ByteBuf>(port, requestHandler).build();
}
 
開發者ID:allenxwang,項目名稱:RxNetty,代碼行數:4,代碼來源:RxNetty.java

示例5: newHttpServerBuilder

import io.reactivex.netty.protocol.http.server.HttpServerBuilder; //導入依賴的package包/類
public static <I, O> HttpServerBuilder<I, O> newHttpServerBuilder(int port, RequestHandler<I, O> router) {
    return RxContexts.newHttpServerBuilder(port, new HttpRequestHandler<I, O>(router), RxContexts.DEFAULT_CORRELATOR);
}
 
開發者ID:Netflix,項目名稱:karyon,代碼行數:4,代碼來源:KaryonTransport.java


注:本文中的io.reactivex.netty.protocol.http.server.HttpServerBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。