Package org.glassfish.jersey.jetty
Class JettyHttpContainerFactory
- java.lang.Object
-
- org.glassfish.jersey.jetty.JettyHttpContainerFactory
-
public final class JettyHttpContainerFactory extends Object
Factory for creating and starting Jetty server handlers. This returns a handle to the started server asServer
instances, which allows the server to be stopped by invoking theAbstractLifeCycle.stop()
method. To start the server in HTTPS mode anSslContextFactory
can be provided. This will be used to decrypt and encrypt information sent over the connected TCP socket channel.- Author:
- Arul Dhesiaseelan ([email protected]), Marek Potociar
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.jetty.server.Server
createServer(URI uri)
Creates aServer
instance that registers anHandler
.static org.eclipse.jetty.server.Server
createServer(URI uri, boolean start)
Creates aServer
instance that registers anHandler
.static org.eclipse.jetty.server.Server
createServer(URI uri, org.eclipse.jetty.util.ssl.SslContextFactory.Server sslContextFactory, JettyHttpContainer handler, boolean start)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes found by searching the classes referenced in the java classpath.static org.eclipse.jetty.server.Server
createServer(URI uri, org.eclipse.jetty.util.ssl.SslContextFactory.Server sslContextFactory, ResourceConfig config)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.static org.eclipse.jetty.server.Server
createServer(URI uri, ResourceConfig config)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.static org.eclipse.jetty.server.Server
createServer(URI uri, ResourceConfig configuration, boolean start)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.static org.eclipse.jetty.server.Server
createServer(URI uri, ResourceConfig config, boolean start, Object parentContext)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.static org.eclipse.jetty.server.Server
createServer(URI uri, ResourceConfig config, Object parentContext)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.
-
-
-
Method Detail
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri) throws ProcessingException
Creates aServer
instance that registers anHandler
.- Parameters:
uri
- uri on which theApplicationHandler
will be deployed. Only first path segment will be used as context path, the rest will be ignored.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, boolean start) throws ProcessingException
Creates aServer
instance that registers anHandler
.- Parameters:
uri
- uri on which theApplicationHandler
will be deployed. Only first path segment will be used as context path, the rest will be ignored.start
- if set to false, server will not get started, which allows to configure the underlying transport layer, see above for details.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, ResourceConfig config) throws ProcessingException
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration. This implementation defers to theContainerFactory.createContainer(Class, jakarta.ws.rs.core.Application)
method for creating an Container that manages the root resources.- Parameters:
uri
- the URI to create the http server. The URI scheme must be equal to "http". The URI user information and host are ignored If the URI port is not present then port 80 will be used. The URI path, query and fragment components are ignored.config
- the resource configuration.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, ResourceConfig configuration, boolean start) throws ProcessingException
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration. This implementation defers to theContainerFactory.createContainer(Class, jakarta.ws.rs.core.Application)
method for creating an Container that manages the root resources.- Parameters:
uri
- URI on which the Jersey web application will be deployed. Only first path segment will be used as context path, the rest will be ignored.configuration
- web application configuration.start
- if set to false, server will not get started, which allows to configure the underlying transport layer, see above for details.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, ResourceConfig config, boolean start, Object parentContext)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.- Parameters:
uri
- the URI to create the http server. The URI scheme must be equal to "https". The URI user information and host are ignored If the URI port is not present then port 143 will be used. The URI path, query and fragment components are ignored.config
- the resource configuration.parentContext
- DI provider specific context with application's registered bindings.start
- if set to false, server will not get started, this allows end users to set additional properties on the underlying listener.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.- Since:
- 2.12
- See Also:
JettyHttpContainer
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, ResourceConfig config, Object parentContext)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration.- Parameters:
uri
- the URI to create the http server. The URI scheme must be equal to "https". The URI user information and host are ignored If the URI port is not present then port 143 will be used. The URI path, query and fragment components are ignored.config
- the resource configuration.parentContext
- DI provider specific context with application's registered bindings.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.- Since:
- 2.12
- See Also:
JettyHttpContainer
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, org.eclipse.jetty.util.ssl.SslContextFactory.Server sslContextFactory, ResourceConfig config) throws ProcessingException
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes declared by the resource configuration. This implementation defers to theContainerFactory.createContainer(Class, jakarta.ws.rs.core.Application)
method for creating an Container that manages the root resources.- Parameters:
uri
- the URI to create the http server. The URI scheme must be equal tohttps
. The URI user information and host are ignored. If the URI port is not present then port 443 will be used. The URI path, query and fragment components are ignored.sslContextFactory
- this is the SSL context factory used to configure SSL connectorconfig
- the resource configuration.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.
-
createServer
public static org.eclipse.jetty.server.Server createServer(URI uri, org.eclipse.jetty.util.ssl.SslContextFactory.Server sslContextFactory, JettyHttpContainer handler, boolean start)
Create aServer
that registers anHandler
that in turn manages all root resource and provider classes found by searching the classes referenced in the java classpath.- Parameters:
uri
- the URI to create the http server. The URI scheme must be equal tohttps
. The URI user information and host are ignored. If the URI port is not present then port 443 will be used. The URI path, query and fragment components are ignored.sslContextFactory
- this is the SSL context factory used to configure SSL connectorhandler
- the container that handles all HTTP requestsstart
- if set to false, server will not get started, this allows end users to set additional properties on the underlying listener.- Returns:
- newly created
Server
. - Throws:
ProcessingException
- in case of any failure when creating a new JettyServer
instance.IllegalArgumentException
- ifuri
isnull
.- See Also:
JettyHttpContainer
-
-