Package io.grpc.servlet.jakarta
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionio.grpc.Server
build()
Builds a gRPC server that can run as a servlet.Creates aServletAdapter
.protected io.grpc.ServerBuilder<?>
delegate()
maxInboundMessageSize
(int bytes) scheduledExecutorService
(ScheduledExecutorService scheduler) Provides a custom scheduled executor service to the server builder.useTransportSecurity
(File certChain, File privateKey) ThrowsUnsupportedOperationException
.Methods inherited from class io.grpc.ForwardingServerBuilder
addService, addService, addStreamTracerFactory, addTransportFilter, callExecutor, compressorRegistry, decompressorRegistry, directExecutor, executor, fallbackHandlerRegistry, forPort, handshakeTimeout, intercept, keepAliveTime, keepAliveTimeout, maxConnectionAge, maxConnectionAgeGrace, maxConnectionIdle, maxInboundMetadataSize, permitKeepAliveTime, permitKeepAliveWithoutCalls, setBinaryLog, toString, useTransportSecurity
Methods inherited from class io.grpc.ServerBuilder
addServices
-
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 callbuild()
andstart()
appropriately.- Overrides:
build
in classio.grpc.ForwardingServerBuilder<ServletServerBuilder>
- Throws:
IllegalStateException
- if this method is called by users directly
-
buildServletAdapter
Creates aServletAdapter
. -
delegate
@Internal protected io.grpc.ServerBuilder<?> delegate()- Specified by:
delegate
in classio.grpc.ForwardingServerBuilder<ServletServerBuilder>
-
useTransportSecurity
ThrowsUnsupportedOperationException
. TLS should be configured by the servlet container.- Overrides:
useTransportSecurity
in classio.grpc.ForwardingServerBuilder<ServletServerBuilder>
-
maxInboundMessageSize
- Overrides:
maxInboundMessageSize
in classio.grpc.ForwardingServerBuilder<ServletServerBuilder>
-
scheduledExecutorService
Provides a custom scheduled executor service to the server builder.- Returns:
- this
-