docServiceBuilder.exampleHttpHeaders(entry.getKey(), entry.getValue()); server.serviceUnder(docsPath, docServiceBuilder.build());
docServiceBuilder.exampleHttpHeaders(entry.getKey(), entry.getValue()); server.serviceUnder(docsPath, docServiceBuilder.build());
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); jetty = new Server(0); jetty.setHandler(JettyServiceTest.newWebAppContext()); jetty.start(); sb.serviceUnder( "/jsp/", JettyService.forServer(jetty).decorate(LoggingService.newDecorator())); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.serviceUnder("/", new GrpcServiceBuilder() .addService(new TestServiceImpl()) .build()); } };
@Override protected void configure(ServerBuilder sb) throws Exception { // Prepare Tomcat instances. tomcatWithWebApp = new Tomcat(); tomcatWithWebApp.setPort(0); tomcatWithWebApp.setBaseDir("build" + File.separatorChar + "tomcat-" + UnmanagedTomcatServiceTest.class.getSimpleName() + "-1"); tomcatWithWebApp.addWebapp("", WebAppContainerTest.webAppRoot().getAbsolutePath()); TomcatUtil.engine(tomcatWithWebApp.getService(), "foo").setName("tomcatWithWebApp"); tomcatWithoutWebApp = new Tomcat(); tomcatWithoutWebApp.setPort(0); tomcatWithoutWebApp.setBaseDir("build" + File.separatorChar + "tomcat-" + UnmanagedTomcatServiceTest.class.getSimpleName() + "-2"); assertThat(TomcatUtil.engine(tomcatWithoutWebApp.getService(), "bar")).isNotNull(); // Start the Tomcats. tomcatWithWebApp.start(); tomcatWithoutWebApp.start(); // Bind them to the Server. sb.serviceUnder("/empty/", TomcatService.forConnector("someHost", new Connector())) .serviceUnder("/some-webapp-nohostname/", TomcatService.forConnector(tomcatWithWebApp.getConnector())) .serviceUnder("/no-webapp/", TomcatService.forTomcat(tomcatWithoutWebApp)) .serviceUnder("/some-webapp/", TomcatService.forTomcat(tomcatWithWebApp)); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.defaultMaxRequestLength(0); sb.defaultRequestTimeoutMillis(0); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(new FlowControlService()) .setMaxInboundMessageSizeBytes(Integer.MAX_VALUE) .build()); } };
sb.service("/foo", fooService); sb.serviceUnder("/foo", fooService); sb.service("/cassandra", cassandraService); sb.service("/cassandra/debug", cassandraServiceDebug); sb.service("/oneway", onewayHelloService); sb.serviceUnder( "/docs/", new DocServiceBuilder()
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.serviceUnder( "/jsp/", new JettyServiceBuilder() .handler(newWebAppContext()) .configurator(s -> jettyBeans.addAll(s.getBeans())) .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/default/", new JettyServiceBuilder().handler(new DefaultHandler()).build()); final ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase(webAppRoot().getPath()); sb.serviceUnder( "/resources/", new JettyServiceBuilder().handler(resourceHandler).build()); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.serviceUnder( "/jsp/", TomcatServiceBuilder.forFileSystem(webAppRoot().toPath()) .serviceName(SERVICE_NAME) .configurator(s -> Collections.addAll(tomcatServices, s.findServices())) .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/jar/", TomcatServiceBuilder.forClassPath(Future.class) .serviceName("TomcatServiceTest-JAR") .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/jar_altroot/", TomcatServiceBuilder.forClassPath(Future.class, "/io/netty/util/concurrent") .serviceName("TomcatServiceTest-JAR-AltRoot") .build() .decorate(LoggingService.newDecorator())); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.serviceUnder("/test", new GrpcServiceBuilder() .addService(new TestService()) .supportedSerializationFormats(GrpcSerializationFormats.values()) .enableUnframedRequests(true) .build()); sb.serviceUnder( "/docs/", new DocServiceBuilder() .exampleRequestForMethod( TestServiceGrpc.SERVICE_NAME, "UnaryCall", SimpleRequest.newBuilder() .setPayload( Payload.newBuilder() .setBody(ByteString.copyFromUtf8("world"))) .build()) .injectedScript(INJECTED_HEADER_PROVIDER1, INJECTED_HEADER_PROVIDER2) .injectedScriptSupplier((ctx, req) -> INJECTED_HEADER_PROVIDER3) .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(mock(ReconnectServiceImplBase.class)) .build()); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.meterRegistry(registry); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(new TestServiceImpl()) .enableUnframedRequests(true) .build() .decorate(MetricCollectingService.newDecorator( MeterIdPrefixFunction.ofDefault("server")))); } };
@Override protected void configure(ServerBuilder sb) throws Exception { ssc = new SelfSignedCertificate("example.com"); sb.serverListener(new ServerListenerAdapter() { @Override public void serverStopped(Server server) { executor.shutdown(); ssc.delete(); } }); sb.https(new InetSocketAddress("127.0.0.1", 0)); sb.tls(newSslContext()); sb.defaultMaxRequestLength(16 * 1024 * 1024); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(ServerInterceptors.intercept( new TestServiceImpl(executor), TestServiceImpl.interceptors())) .build() .decorate((delegate, ctx, req) -> { ctxCapture.set(ctx); return delegate.serve(ctx, req); })); }
sb.idleTimeoutMillis(0); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(new TestServiceImpl(Executors.newSingleThreadScheduledExecutor())) .setMaxInboundMessageSizeBytes(MAX_MESSAGE_SIZE)
@Override protected void configure(ServerBuilder sb) throws Exception { sb.workerGroup(EventLoopGroups.newEventLoopGroup(1), true); sb.defaultMaxRequestLength(0); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(new UnitTestServiceImpl()) .build() .decorate(LoggingService.newDecorator()) .decorate((delegate, ctx, req) -> { ctx.log().addListener(requestLogQueue::add, RequestLogAvailability.COMPLETE); return delegate.serve(ctx, req); })); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.workerGroup(EventLoopGroups.newEventLoopGroup(1), true); sb.defaultMaxRequestLength(Long.MAX_VALUE); sb.serviceUnder("/", new GrpcServiceBuilder() .addService(new UnitTestServiceImpl()) .build() .decorate(LoggingService.newDecorator()) .decorate((delegate, ctx, req) -> { ctx.log().addListener(requestLogQueue::add, RequestLogAvailability.COMPLETE); return delegate.serve(ctx, req); })); } };
@Override protected void configure(ServerBuilder sb) throws Exception { sb.workerGroup(EventLoopGroups.newEventLoopGroup(1), true); sb.defaultMaxRequestLength(0); sb.serviceUnder("/", new GrpcServiceBuilder() .setMaxInboundMessageSizeBytes(MAX_MESSAGE_SIZE) .addService(new UnitTestServiceImpl()) .enableUnframedRequests(true) .supportedSerializationFormats(GrpcSerializationFormats.values()) .build() .decorate(LoggingService.newDecorator()) .decorate((delegate, ctx, req) -> { ctx.log().addListener(requestLogQueue::add, RequestLogAvailability.COMPLETE); return delegate.serve(ctx, req); })); } };
.serviceUnder("/pathWithName", new AbstractHttpService() {
sb.serviceUnder("/docs/", new DocServiceBuilder().exampleHttpHeaders( CentralDogmaService.class,
sb.serviceUnder("/docs/", new DocServiceBuilder().exampleHttpHeaders( CentralDogmaService.class,
sb.serviceUnder(BUILTIN_WEB_BASE_PATH, new OrElseDefaultHttpFileService( HttpFileService.forClassPath("auth-webapp"), "/index.html")); sb.serviceUnder("/", HttpFileService.forClassPath("webapp"));