use of com.linkedin.r2.filter.compression.ServerCompressionFilter in project incubator-gobblin by apache.
the class JobExecutionInfoServer method startUp.
@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();
}
Aggregations