JdkHttpServer
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Sets the size of server's tcp connection backlog. This is the maximum number of queued incoming connections to allow on the listening socket. Queued TCP connections exceeding this limit may be rejected by the TCP implementation. If set to 0 or less the system default for backlog size will be used. Default is 0.
Sets the size of server's tcp connection backlog. This is the maximum number of queued incoming connections to allow on the listening socket. Queued TCP connections exceeding this limit may be rejected by the TCP implementation. If set to 0 or less the system default for backlog size will be used. Default is 0.
Attributes
Sets the base path under which your endpoints will be mounted, so if you have an endpoint configured to respond to /hello path and base path set to /api your endpoint will in fact respond under /api/hello path.
Sets the base path under which your endpoints will be mounted, so if you have an endpoint configured to respond to /hello path and base path set to /api your endpoint will in fact respond under /api/hello path.
The default base path is "/".
Attributes
Allows you to configure the Executor which will be used to handle HTTP requests. By default com.sun.net.httpserver.HttpServer uses a single thread (a calling thread executor to be precise) executor to handle traffic which might be fine for local toy projects.
Allows you to configure the Executor which will be used to handle HTTP requests. By default com.sun.net.httpserver.HttpServer uses a single thread (a calling thread executor to be precise) executor to handle traffic which might be fine for local toy projects.
If you intend to use this HTTP server for any deployments that will run under load it's absolutely necessary to set an executor that will use proper thread pool to handle the load. Recommended approach is to use JdkHttpServerOptions.httpExecutor
method to create a ThreadPoolExecutor that will scale under load. You can also use an Executor returned from any of the constructors in the java.util.concurrent.Executors
class.
Alternatively, if running with a JDK 19+ you can leverage Project Loom and use Executors.newVirtualThreadPerTaskExecutor()
to run each request on a virtual thread. This however means it is possible for your server to be overloaded with work as each request will be given a thread with no backpressure on how many should be executed in parallel.
Attributes
Sets the hostname to which the server will be bound.
Sets the hostname to which the server will be bound.
Attributes
Takes an instance of com.sun.net.httpserver.HttpsConfigurator, which is a thin wrapper around javax.net.ssl.SSLContext to configure the SSL termination for this server.
Takes an instance of com.sun.net.httpserver.HttpsConfigurator, which is a thin wrapper around javax.net.ssl.SSLContext to configure the SSL termination for this server.
Attributes
Replace the options - any modifications to the host, prot, executor etc. will be replaced with what is configured in the given options instance. Useful for customising interceptors.
Replace the options - any modifications to the host, prot, executor etc. will be replaced with what is configured in the given options instance. Useful for customising interceptors.
Attributes
Sets the port to which the server will be bound.
Sets the port to which the server will be bound.
Attributes
Use this if you want to add more routes manually, outside of the routes defined with tapir. Afterwards it is necessary to call HttpServer.start()
to actually start the server.
Use this if you want to add more routes manually, outside of the routes defined with tapir. Afterwards it is necessary to call HttpServer.start()
to actually start the server.
Attributes
Setup and start the server in the background.
Setup and start the server in the background.
Attributes
Inherited methods
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product