A
Servlet or
Filter for deploying root resource classes.
If this class is declared as a filter and the initialization parameter
#PROPERTY_WEB_PAGE_CONTENT_REGEX is not set
or
#FEATURE_FILTER_FORWARD_ON_404 is not set to true then the filter
must be declared at the last position in the filter chain as the filter will
not forward any request to a next filter (if any) in the chain.
The following sections make reference to initialization parameters. Unless
otherwise specified the initialization parameters apply to both server
and filter initialization parameters.
The servlet or filter may be configured to have an initialization
parameter "com.sun.jersey.config.property.resourceConfigClass" or
"javax.ws.rs.Application" and whose value is a
fully qualified name of a class that implements
ResourceConfig or
Application.
If the concrete class has a constructor that takes a single parameter of the
type Map then the class is instantiated with that constructor and an instance
of Map that contains all the initialization parameters is passed as the
parameter. Otherwise, the class is instantiated as a singleton component
managed by the runtime, and injection may be performed (the artifacts that
may be injected are limited to injectable providers registered when
the servlet or filter is configured).
If the initialization parameter
"com.sun.jersey.config.property.resourceConfigClass" or
"javax.ws.rs.Application" is not present and a
initialization parameter "com.sun.jersey.config.property.packages" is present
(see
PackagesResourceConfig#PROPERTY_PACKAGES) a new instance of
PackagesResourceConfig is created. The initialization parameter
"com.sun.jersey.config.property.packages" MUST be set to provide one or
more package names. Each package name MUST be separated by ';'.
The package names are added as a property value to a Map instance using
the property name
com.sun.jersey.api.core.PackagesResourceConfig#PROPERTY_PACKAGES.
Any additional initialization parameters are then added to the Map instance.
Then that Map instance is passed to the constructor of
PackagesResourceConfig.
If none of the above resource configuration related initialization parameters
are present a new instance of
WebAppResourceConfig is created. The
initialization parameter "com.sun.jersey.config.property.classpath" MAY be
set to provide one or more resource paths. Each path MUST be separated by ';'.
The resource paths are added as a property value to a Map instance using
the property name
com.sun.jersey.api.core.ClasspathResourceConfig#PROPERTY_CLASSPATH.
Any additional initialization parameters are then added to the Map instance.
Then that Map instance is passed to the constructor of
WebAppResourceConfig.
If the initialization parameter is not present then the following resource
paths are utilized:
"/WEB-INF/lib" and "/WEB-INF/classes".
All initialization parameters are added as properties of the created
ResourceConfig.
A new
WebApplication instance will be created and configured such
that the following classes may be injected onto a root resource, provider
and
Application classes using
javax.ws.rs.core.Context:
HttpServletRequest,
HttpServletResponse,
ServletContext,
ServletConfig and
WebConfig.
If this class is used as a Servlet then the
ServletConfig class may
be injected. If this class is used as a Filter then the
FilterConfigclass may be injected.
WebConfig may be injected to abstract
servlet or filter deployment.
A
IoCComponentProviderFactory instance may be registered by extending this class
and overriding the method
#initiate(ResourceConfig,WebApplication)to initiate the
WebApplication with the
IoCComponentProviderFactoryinstance.