@Override public void configure(Binder binder) { httpClientBinder(binder).bindHttpClient("proxy", ForProxy.class); configBinder(binder).bindConfig(ProxyConfig.class); configBinder(binder).bindConfig(JwtHandlerConfig.class, "proxy"); jaxrsBinder(binder).bind(ProxyResource.class); binder.bind(JsonWebTokenHandler.class).in(Scopes.SINGLETON); } }
public static void start(Module... extraModules) { Bootstrap app = new Bootstrap(ImmutableList.<Module>builder() .add(new NodeModule()) .add(new HttpServerModule()) .add(new JsonModule()) .add(new JaxrsModule(true)) .add(new MBeanModule()) .add(new JmxModule()) .add(new LogJmxModule()) .add(new TraceTokenModule()) .add(new EventModule()) .add(new ProxyModule()) .add(extraModules) .build()); Logger log = Logger.get(PrestoProxy.class); try { app.strictConfig().initialize(); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
@Override public int read(byte[] b) throws IOException { throw new TestingJsonProcessingException("forced JsonProcessingException"); }
@Override public void configure(Binder binder) { jaxrsBinder(binder).bind(TestResource.class); httpClientBinder(binder) .bindHttpClient("test", GenerateTokenFilterTest.class) .withTracing() .withFilter(GenerateTraceTokenRequestFilter.class); } }
.add(new TestingHttpServerModule(parseInt(coordinator ? coordinatorPort : "0"))) .add(new JsonModule()) .add(new JaxrsModule(true)) .add(new MBeanModule()) .add(new TestingJmxModule())
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
@Override public int read(byte[] b, int off, int len) throws IOException { throw new TestingJsonProcessingException("forced JsonProcessingException"); } });
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
@Override public void configure(Binder binder) { configBinder(binder).bindConfig(InternalCommunicationConfig.class); configBinder(binder).bindConfig(QueryManagerConfig.class); discoveryBinder(binder).bindSelector("presto"); discoveryBinder(binder).bindHttpAnnouncement("presto"); // Jersey with jetty 9 requires at least one resource // todo add a dummy resource to airlift jaxrs in this case jaxrsBinder(binder).bind(FooResource.class); } });
new HttpServerModule(), new JsonModule(), new JaxrsModule(true), new MBeanModule(), new JmxModule(),
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
@Override public int read() throws IOException { throw new TestingJsonProcessingException("forced JsonProcessingException"); }
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class); jsonCodecBinder(binder).bindJsonCodec(QueryResults.class); jaxrsBinder(binder).bind(StatementResource.class); binder.bind(StatementHttpExecutionMBean.class).in(Scopes.SINGLETON); newExporter(binder).export(StatementHttpExecutionMBean.class).withGeneratedName(); jaxrsBinder(binder).bind(WebUiResource.class); jaxrsBinder(binder).bind(NodeResource.class); jaxrsBinder(binder).bind(WorkerResource.class); httpClientBinder(binder).bindHttpClient("workerInfo", ForWorkerInfo.class); jaxrsBinder(binder).bind(QueryResource.class); jaxrsBinder(binder).bind(StageResource.class); jaxrsBinder(binder).bind(QueryStateInfoResource.class); jaxrsBinder(binder).bind(ResourceGroupStateInfoResource.class); binder.bind(QueryIdGenerator.class).in(Scopes.SINGLETON); binder.bind(QueryManager.class).to(SqlQueryManager.class).in(Scopes.SINGLETON); jaxrsBinder(binder).bind(ClusterStatsResource.class);
new TraceTokenModule(), new JsonModule(), new JaxrsModule(true), new FailureDetectorModule(), new Module()
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return canReadOrWrite(type); }
sqlParserOptions.useEnhancedErrorHandler(serverConfig.isEnhancedErrorReporting()); jaxrsBinder(binder).bind(ThrowableMapper.class); jaxrsBinder(binder).bind(TaskResource.class); newExporter(binder).export(TaskResource.class).withGeneratedName(); jaxrsBinder(binder).bind(TaskExecutorResource.class); newExporter(binder).export(TaskExecutorResource.class).withGeneratedName(); binder.bind(TaskManagementExecutor.class).in(Scopes.SINGLETON); jsonCodecBinder(binder).bindJsonCodec(OperatorStats.class); jsonCodecBinder(binder).bindJsonCodec(ExecutionFailureInfo.class); jaxrsBinder(binder).bind(PagesResponseWriter.class); jaxrsBinder(binder).bind(MemoryResource.class); jaxrsBinder(binder).bind(ServerInfoResource.class); jsonCodecBinder(binder).bindJsonCodec(ServerInfo.class); jaxrsBinder(binder).bind(StatusResource.class); jsonCodecBinder(binder).bindJsonCodec(NodeStatus.class); jaxrsBinder(binder).bind(ThreadResource.class);
new TestingHttpServerModule(), new JsonModule(), new JaxrsModule(true), new TestingJmxModule(), new ProxyModule());