Class HttpServer.Builder
java.lang.Object
com.soklet.HttpServer.Builder
- Enclosing interface:
HttpServer
Builder used to construct a standard implementation of
HttpServer.
This class is intended for use by a single thread.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()concurrency(@Nullable Integer concurrency) idGenerator(@Nullable IdGenerator<?> idGenerator) maximumConnections(@Nullable Integer maximumConnections) maximumHeaderCount(@Nullable Integer maximumHeaderCount) Sets the maximum number of HTTP header fields accepted in one request.maximumRequestSizeInBytes(@Nullable Integer maximumRequestSizeInBytes) Sets the maximum accepted HTTP request size in bytes.maximumRequestTargetLengthInBytes(@Nullable Integer maximumRequestTargetLengthInBytes) Sets the maximum request-target length accepted in bytes.multipartParser(@Nullable MultipartParser multipartParser) requestBodyTimeout(@Nullable Duration requestBodyTimeout) Sets the maximum duration for reading the HTTP request body after the request line and headers have been received.requestHandlerConcurrency(@Nullable Integer requestHandlerConcurrency) requestHandlerExecutorServiceSupplier(@Nullable Supplier<ExecutorService> requestHandlerExecutorServiceSupplier) requestHandlerQueueCapacity(@Nullable Integer requestHandlerQueueCapacity) requestHandlerTimeout(@Nullable Duration requestHandlerTimeout) requestHeaderTimeout(@Nullable Duration requestHeaderTimeout) Sets the maximum duration for reading the HTTP request line and headers.requestReadBufferSizeInBytes(@Nullable Integer requestReadBufferSizeInBytes) shutdownTimeout(@Nullable Duration shutdownTimeout) socketPendingConnectionLimit(@Nullable Integer socketPendingConnectionLimit) socketSelectTimeout(@Nullable Duration socketSelectTimeout) streamingChunkSizeInBytes(@Nullable Integer streamingChunkSizeInBytes) Sets the maximum payload chunk size used for HTTP/1.1 chunked streaming.streamingExecutorServiceSupplier(@Nullable Supplier<ExecutorService> streamingExecutorServiceSupplier) Sets the executor service supplier used to run streaming response producers.streamingQueueCapacityInBytes(@Nullable Integer streamingQueueCapacityInBytes) Sets the per-stream producer queue capacity in bytes.streamingResponseIdleTimeout(@Nullable Duration streamingResponseIdleTimeout) Sets the maximum idle duration between bytes produced for a streaming response.streamingResponseTimeout(@Nullable Duration streamingResponseTimeout) Sets the maximum total duration for a streaming response.
-
Method Details
-
port
-
host
-
concurrency
-
requestHeaderTimeout
Sets the maximum duration for reading the HTTP request line and headers.If this value is not specified, Soklet uses the server default.
- Parameters:
requestHeaderTimeout- the request header timeout, ornullfor the default- Returns:
- this builder
-
requestBodyTimeout
Sets the maximum duration for reading the HTTP request body after the request line and headers have been received.If this value is not specified, Soklet uses the server default.
- Parameters:
requestBodyTimeout- the request body timeout, ornullfor the default- Returns:
- this builder
-
requestHandlerTimeout
-
requestHandlerConcurrency
public @NonNull HttpServer.Builder requestHandlerConcurrency(@Nullable Integer requestHandlerConcurrency) -
requestHandlerQueueCapacity
public @NonNull HttpServer.Builder requestHandlerQueueCapacity(@Nullable Integer requestHandlerQueueCapacity) -
socketSelectTimeout
-
socketPendingConnectionLimit
public @NonNull HttpServer.Builder socketPendingConnectionLimit(@Nullable Integer socketPendingConnectionLimit) -
maximumConnections
-
shutdownTimeout
-
maximumRequestSizeInBytes
public @NonNull HttpServer.Builder maximumRequestSizeInBytes(@Nullable Integer maximumRequestSizeInBytes) Sets the maximum accepted HTTP request size in bytes.This limit applies to the whole received HTTP request, including request line, headers, transfer framing, and body bytes. Applications that think in terms of payload size should leave room for request metadata and protocol framing.
- Parameters:
maximumRequestSizeInBytes- the maximum request size, ornullfor the default- Returns:
- this builder
-
maximumHeaderCount
Sets the maximum number of HTTP header fields accepted in one request.- Parameters:
maximumHeaderCount- the maximum header count, ornullfor the default- Returns:
- this builder
-
maximumRequestTargetLengthInBytes
public @NonNull HttpServer.Builder maximumRequestTargetLengthInBytes(@Nullable Integer maximumRequestTargetLengthInBytes) Sets the maximum request-target length accepted in bytes.- Parameters:
maximumRequestTargetLengthInBytes- the maximum request-target length, ornullfor the default- Returns:
- this builder
-
requestReadBufferSizeInBytes
public @NonNull HttpServer.Builder requestReadBufferSizeInBytes(@Nullable Integer requestReadBufferSizeInBytes) -
multipartParser
-
requestHandlerExecutorServiceSupplier
public @NonNull HttpServer.Builder requestHandlerExecutorServiceSupplier(@Nullable Supplier<ExecutorService> requestHandlerExecutorServiceSupplier) -
streamingExecutorServiceSupplier
public @NonNull HttpServer.Builder streamingExecutorServiceSupplier(@Nullable Supplier<ExecutorService> streamingExecutorServiceSupplier) Sets the executor service supplier used to run streaming response producers.- Parameters:
streamingExecutorServiceSupplier- the executor service supplier, ornullfor the default- Returns:
- this builder
-
streamingQueueCapacityInBytes
public @NonNull HttpServer.Builder streamingQueueCapacityInBytes(@Nullable Integer streamingQueueCapacityInBytes) Sets the per-stream producer queue capacity in bytes.- Parameters:
streamingQueueCapacityInBytes- the queue capacity, ornullfor the default- Returns:
- this builder
-
streamingChunkSizeInBytes
public @NonNull HttpServer.Builder streamingChunkSizeInBytes(@Nullable Integer streamingChunkSizeInBytes) Sets the maximum payload chunk size used for HTTP/1.1 chunked streaming.- Parameters:
streamingChunkSizeInBytes- the payload chunk size, ornullfor the default- Returns:
- this builder
-
streamingResponseTimeout
public @NonNull HttpServer.Builder streamingResponseTimeout(@Nullable Duration streamingResponseTimeout) Sets the maximum total duration for a streaming response.Use
Duration.ZEROto disable the timeout.- Parameters:
streamingResponseTimeout- the streaming response timeout, ornullfor the default- Returns:
- this builder
-
streamingResponseIdleTimeout
public @NonNull HttpServer.Builder streamingResponseIdleTimeout(@Nullable Duration streamingResponseIdleTimeout) Sets the maximum idle duration between bytes produced for a streaming response.Use
Duration.ZEROto disable the timeout.- Parameters:
streamingResponseIdleTimeout- the streaming response idle timeout, ornullfor the default- Returns:
- this builder
-
idGenerator
-
build
-