Class ServletServerBuilder

java.lang.Object
io.grpc.ServerBuilder<T>
io.grpc.ForwardingServerBuilder<ServletServerBuilder>
io.grpc.servlet.jakarta.ServletServerBuilder

@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5066") @NotThreadSafe public final class ServletServerBuilder extends io.grpc.ForwardingServerBuilder<ServletServerBuilder>
Builder to build a gRPC server that can run as a servlet. This is for advanced custom settings. Normally, users should consider extending the out-of-box GrpcServlet directly instead.

The API is experimental. The authors would like to know more about the real usecases. Users are welcome to provide feedback by commenting on the tracking issue.

  • Constructor Details

    • ServletServerBuilder

      public ServletServerBuilder()
  • Method Details

    • build

      public io.grpc.Server build()
      Builds a gRPC server that can run as a servlet.

      The returned server will not be started or bound to a port.

      Users should not call this method directly. Instead users should call buildServletAdapter() which internally will call build() and start() appropriately.

      Overrides:
      build in class io.grpc.ForwardingServerBuilder<ServletServerBuilder>
      Throws:
      IllegalStateException - if this method is called by users directly
    • buildServletAdapter

      public ServletAdapter buildServletAdapter()
      Creates a ServletAdapter.
    • delegate

      @Internal protected io.grpc.ServerBuilder<?> delegate()
      Specified by:
      delegate in class io.grpc.ForwardingServerBuilder<ServletServerBuilder>
    • useTransportSecurity

      public ServletServerBuilder useTransportSecurity(File certChain, File privateKey)
      Throws UnsupportedOperationException. TLS should be configured by the servlet container.
      Overrides:
      useTransportSecurity in class io.grpc.ForwardingServerBuilder<ServletServerBuilder>
    • maxInboundMessageSize

      public ServletServerBuilder maxInboundMessageSize(int bytes)
      Overrides:
      maxInboundMessageSize in class io.grpc.ForwardingServerBuilder<ServletServerBuilder>
    • scheduledExecutorService

      public ServletServerBuilder scheduledExecutorService(ScheduledExecutorService scheduler)
      Provides a custom scheduled executor service to the server builder.
      Returns:
      this