public class DeploymentContext extends Object
An instance of this class is created by creating using DeploymentContext.Builder
, that allows to configure the deployment
context state, and finally building the context by invoking the DeploymentContext.Builder.build()
method.
This deployment context is compatible with basic non-Servlet test containers. The following test container factories support the descriptor:
org.glassfish.jersey.test.grizzly.GrizzlyTestContainerFactory
for testing with the Grizzly HTTP container.org.glassfish.jersey.test.jetty.JettyTestContainerFactory
for testing with the Jetty HTTP container.org.glassfish.jersey.test.simple.SimpleTestContainerFactory
for testing with the Simple HTTP container.org.glassfish.jersey.test.jdkhttp.JdkHttpServerTestContainerFactory
for testing with the Light Weight HTTP
server distributed with Java SE.org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory
for testing in memory without
using underlying HTTP client and server side functionality to send requests and receive responses.org.glassfish.jersey.test.external.ExternalTestContainerFactory
for testing Java EE Web
applications deployed independently in a separate JVM to that of the tests. For example, the application
may be deployed to the GlassFish or WebLogic application server.Modifier and Type | Class and Description |
---|---|
static class |
DeploymentContext.Builder
Deployment context builder for building a basic application deployment context for the JAX-RS / Jersey application
defined by the associated
Application class or instance. |
Modifier | Constructor and Description |
---|---|
protected |
DeploymentContext(DeploymentContext.Builder b)
Create new application deployment context.
|
Modifier and Type | Method and Description |
---|---|
static DeploymentContext.Builder |
builder(Application application)
Create a new deployment context builder for a JAX-RS / Jersey application instance.
|
static DeploymentContext.Builder |
builder(Class<? extends Application> applicationClass)
Create a new deployment context builder for a JAX-RS / Jersey application instance.
|
String |
getContextPath()
Get the deployed application context path.
|
ResourceConfig |
getResourceConfig()
Get the deployed application resource configuration.
|
static DeploymentContext |
newInstance(Application application)
Create a new deployment context for a JAX-RS / Jersey application instance.
|
static DeploymentContext |
newInstance(Class<? extends Application> applicationClass)
Create a new deployment context for a JAX-RS / Jersey application instance.
|
protected DeploymentContext(DeploymentContext.Builder b)
b
- DeploymentContext.Builder
instance.public static DeploymentContext.Builder builder(Application application)
application
- a JAX-RS / Jersey application to be tested.NullPointerException
- in case the application
is null
.public static DeploymentContext.Builder builder(Class<? extends Application> applicationClass)
applicationClass
- a JAX-RS / Jersey application to be tested.NullPointerException
- in case the applicationClass
is null
.public static DeploymentContext newInstance(Application application)
The created deployment context will be configured to use default values.
application
- a JAX-RS / Jersey application to be tested.NullPointerException
- in case the application
is null
.public static DeploymentContext newInstance(Class<? extends Application> applicationClass)
The created deployment context will be configured to use default values.
applicationClass
- a JAX-RS / Jersey application to be tested.NullPointerException
- in case the applicationClass
is null
.public ResourceConfig getResourceConfig()
This method can be overridden in a subclass to support conversion of non-resource config initialization scenario (e.g. via Servlet init parameters) into a resource configuration.
public final String getContextPath()
Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.