use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher in project rest.li by linkedin.
the class LoadBalancerEchoServer method startServer.
public void startServer() throws IOException, InterruptedException, URISyntaxException {
final RestDispatcher restDispatcher = new RestDispatcher();
final TransportDispatcherBuilder dispatcherBuilder = new TransportDispatcherBuilder();
for (String validPath : _validPaths) {
dispatcherBuilder.addRestHandler(URI.create(validPath), restDispatcher);
}
final TransportDispatcher dispatcher = dispatcherBuilder.build();
// start the server
if (_scheme.equals("http")) {
_server = getHttpServer(dispatcher);
}
_server.start();
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher in project rest.li by linkedin.
the class HttpServerFactory method createServer.
public HttpServer createServer(int port, String contextPath, int threadPoolSize, TransportDispatcher transportDispatcher, HttpJettyServer.ServletType servletType, int asyncTimeOut, boolean restOverStream) {
final TransportDispatcher filterDispatcher = new FilterChainDispatcher(transportDispatcher, _filters);
final HttpDispatcher dispatcher = new HttpDispatcher(filterDispatcher);
return new HttpJettyServer(port, contextPath, threadPoolSize, dispatcher, servletType, asyncTimeOut, restOverStream);
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher in project rest.li by linkedin.
the class HttpServerFactory method createRAPServer.
public HttpServer createRAPServer(int port, TransportDispatcher transportDispatcher, int timeout, boolean restOverStream) {
final TransportDispatcher filterDispatcher = new FilterChainDispatcher(transportDispatcher, _filters);
HttpServlet httpServlet = restOverStream ? new RAPStreamServlet(filterDispatcher, timeout) : new RAPServlet(filterDispatcher);
return new HttpJettyServer(port, httpServlet);
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher in project rest.li by linkedin.
the class HttpNettyServerFactory method createServer.
public HttpServer createServer(int port, int threadPoolSize, TransportDispatcher transportDispatcher) {
final TransportDispatcher filterDispatcher = new FilterChainDispatcher(transportDispatcher, _filters);
final HttpDispatcher dispatcher = new HttpDispatcher(filterDispatcher);
return new HttpNettyServer(port, threadPoolSize, dispatcher);
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher in project rest.li by linkedin.
the class TestMIMEChainingMultipleSources method setup.
@BeforeMethod
public void setup() throws IOException {
_latch = new CountDownLatch(2);
_clientFactory = new HttpClientFactory();
_client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()));
_server_A_client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()));
final HttpServerFactory httpServerFactory = new HttpServerFactory();
final ServerARequestHandler serverARequestHandler = new ServerARequestHandler();
final TransportDispatcher serverATransportDispatcher = new TransportDispatcherBuilder().addStreamHandler(SERVER_A_URI, serverARequestHandler).build();
final ServerBRequestHandler serverBRequestHandler = new ServerBRequestHandler();
final TransportDispatcher serverBTransportDispatcher = new TransportDispatcherBuilder().addStreamHandler(SERVER_B_URI, serverBRequestHandler).build();
_serverA = httpServerFactory.createServer(PORT_SERVER_A, serverATransportDispatcher, true);
_serverB = httpServerFactory.createServer(PORT_SERVER_B, serverBTransportDispatcher, true);
_serverA.start();
_serverB.start();
}
Aggregations