@Override protected void startUp() throws Exception { RestLiConfig config = new RestLiConfig(); Set<String> resourceClassNames = Sets.newHashSet(); for (Class<? extends BaseResource> resClass : this.resources) { resourceClassNames.add(resClass.getName()); } config.addResourceClassNames(resourceClassNames); config.setServerNodeUri(this.serverUri); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); config.addFilter(new RestLiValidationFilter()); ResourceFactory factory = new GuiceInjectResourceFactory(this.injector); TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory)); String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName(); FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters)); this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(this.port, dispatcher)); this.log.info("Starting the {} embedded server at port {}.", this.name, this.port); this.httpServer.get().start(); }
@Override public void handleRequest(RestRequest request, RequestContext requestContext, Callback<RestResponse> callback) { //This code path cannot accept content types or accept types that contain //multipart/related. This is because these types of requests will usually have very large payloads and therefore //would degrade server performance since RestRequest reads everything into memory. if (!isMultipart(request, callback)) { _restRestLiServer.handleRequest(request, requestContext, callback); } }
@Override protected void startUp() throws Exception { // Server configuration RestLiConfig config = new RestLiConfig(); config.addResourcePackageNames(JobExecutionInfoResource.class.getPackage().getName()); config.setServerNodeUri(serverUri); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); // Handle dependency injection Injector injector = Guice.createInjector(new MetaStoreModule(properties)); JobHistoryStore jobHistoryStore = injector.getInstance(JobHistoryStore.class); SimpleBeanProvider beanProvider = new SimpleBeanProvider(); beanProvider.add("jobHistoryStore", jobHistoryStore); // Use InjectMockResourceFactory to keep this Spring free ResourceFactory factory = new InjectMockResourceFactory(beanProvider); // Create and start the HTTP server TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory)); String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName(); FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters)); this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(port, dispatcher)); LOGGER.info("Starting the job execution information server"); this.httpServer.get().start(); }
@Override protected void startUp() throws Exception { // Server configuration RestLiConfig config = new RestLiConfig(); config.addResourcePackageNames(JobExecutionInfoResource.class.getPackage().getName()); config.setServerNodeUri(serverUri); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); // Handle dependency injection Injector injector = Guice.createInjector(new MetaStoreModule(properties)); JobHistoryStore jobHistoryStore = injector.getInstance(JobHistoryStore.class); SimpleBeanProvider beanProvider = new SimpleBeanProvider(); beanProvider.add("jobHistoryStore", jobHistoryStore); // Use InjectMockResourceFactory to keep this Spring free ResourceFactory factory = new InjectMockResourceFactory(beanProvider); // Create and start the HTTP server TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory)); String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName(); FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters)); this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(port, dispatcher)); LOGGER.info("Starting the job execution information server"); this.httpServer.get().start(); }
@Inject public GuiceRestliServlet(RestLiConfig config, // required GuiceInjectResourceFactory resourceFactory, // injected automatically by Guice OptionalFilterChain filterChain, OptionalEngine engine) { final RestLiServer restliServer = new RestLiServer(config, resourceFactory, engine.value); _r2Servlet = new RAPServlet( new FilterChainDispatcher( new DelegatingTransportDispatcher(restliServer, restliServer), filterChain.value ) ); }
@Override protected void startUp() throws Exception { RestLiConfig config = new RestLiConfig(); Set<String> resourceClassNames = Sets.newHashSet(); for (Class<? extends BaseResource> resClass : this.resources) { resourceClassNames.add(resClass.getName()); } config.addResourceClassNames(resourceClassNames); config.setServerNodeUri(this.serverUri); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); config.addFilter(new RestLiValidationFilter()); ResourceFactory factory = new GuiceInjectResourceFactory(this.injector); TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory)); String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName(); FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters)); this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(this.port, dispatcher)); this.log.info("Starting the {} embedded server at port {}.", this.name, this.port); this.httpServer.get().start(); }
@Override protected void startUp() throws Exception { // Server configuration RestLiConfig config = new RestLiConfig(); config.addResourcePackageNames(JobExecutionInfoResource.class.getPackage().getName()); config.setServerNodeUri(serverUri); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); // Handle dependency injection Injector injector = Guice.createInjector(new MetaStoreModule(properties)); JobHistoryStore jobHistoryStore = injector.getInstance(JobHistoryStore.class); SimpleBeanProvider beanProvider = new SimpleBeanProvider(); beanProvider.add("jobHistoryStore", jobHistoryStore); // Use InjectMockResourceFactory to keep this Spring free ResourceFactory factory = new InjectMockResourceFactory(beanProvider); // Create and start the HTTP server TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory)); String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName(); FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters)); this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(port, dispatcher)); LOGGER.info("Starting the job execution information server"); this.httpServer.get().start(); }
.build(); final RestLiServer restLiServer = new RestLiServer( config, resourceFactory,
ResourceFactory resourceFactory = createResourceFactory(beans); TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, resourceFactory, engine));
.build(); final RestLiServer restServer = new RestLiServer(config, new PrototypeResourceFactory(), engine); final TransportDispatcher dispatcher = new DelegatingTransportDispatcher(restServer, restServer); System.err.println("Jetty threadPoolSize: " + threadPoolSize);
RestLiServer restLiServer = new RestLiServer(config, factory, engine); TransportDispatcher dispatcher = new DelegatingTransportDispatcher(restLiServer, restLiServer);