Interface WebServerProvider
-
@Contract @ConstrainedTo(SERVER) public interface WebServerProvider
Service-provider interface for creating server instances. If supported by the provider, a server instance of the requested Java type will be created.The created server uses an internally created
Containerwhich is responsible for listening on a communication channel provided by the server for new client requests, dispatching these requests to the registeredJersey application handlerusing the handler'shandle(requestContext)method and sending the responses provided by the application back to the client.A provider shall support a one-to-one mapping between a type, provided the type is not
Object. A provider may also support mapping of sub-types of a type (provided the type is notObject). It is expected that each provider supports mapping for distinct set of types and subtypes so that different providers do not conflict with each other. In addition, a provider SHOULD support the super typeWebServerto participate in auto-selection of providers (in this case the first supporting provider found is used).An implementation can identify itself by placing a Java service provider configuration file (if not already present) -
org.glassfish.jersey.server.spi.WebServerProvider- in the resource directoryMETA-INF/services, and adding the fully qualified service-provider-class of the implementation in the file.- Since:
- 3.1.0
- Author:
- Markus KARG (markus@headcrashing.eu)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends WebServer>
TcreateServer(Class<T> type, jakarta.ws.rs.core.Application application, JerseySeBootstrapConfiguration configuration)Creates a server of a given type which runs the given application using the given bootstrap configuration.<T extends WebServer>
TcreateServer(Class<T> type, Class<? extends jakarta.ws.rs.core.Application> applicationClass, JerseySeBootstrapConfiguration configuration)Creates a server of a given type which runs the given application using the given bootstrap configuration.
-
-
-
Method Detail
-
createServer
<T extends WebServer> T createServer(Class<T> type, jakarta.ws.rs.core.Application application, JerseySeBootstrapConfiguration configuration) throws jakarta.ws.rs.ProcessingException
Creates a server of a given type which runs the given application using the given bootstrap configuration.- Type Parameters:
T- the type of the web server.- Parameters:
type- the type of the web server. Providers SHOULD support at leastWebServer.application- The application to host.configuration- The configuration (host, port, etc.) to be used for bootstrapping.- Returns:
- the server, otherwise
nullif the provider does not support the requestedtype. - Throws:
jakarta.ws.rs.ProcessingException- if there is an error creating the server.
-
createServer
<T extends WebServer> T createServer(Class<T> type, Class<? extends jakarta.ws.rs.core.Application> applicationClass, JerseySeBootstrapConfiguration configuration) throws jakarta.ws.rs.ProcessingException
Creates a server of a given type which runs the given application using the given bootstrap configuration.- Type Parameters:
T- the type of the web server.- Parameters:
type- the type of the web server. Providers SHOULD support at leastWebServer.applicationClass- The class of application to host.configuration- The configuration (host, port, etc.) to be used for bootstrapping.- Returns:
- the server, otherwise
nullif the provider does not support the requestedtype. - Throws:
jakarta.ws.rs.ProcessingException- if there is an error creating the server.
-
-