A {@link Servlet} or {@link Filter} for deploying root resource classes.
If this class is declared as a filter and the initialization parameter {@link #PROPERTY_WEB_PAGE_CONTENT_REGEX} is not setor {@link #FEATURE_FILTER_FORWARD_ON_404} is not set to true then the filtermust 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 {@link ResourceConfig} or{@link 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 {@link PackagesResourceConfig#PROPERTY_PACKAGES}) a new instance of {@link 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 {@value 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 {@link PackagesResourceConfig}.
If none of the above resource configuration related initialization parameters are present a new instance of {@link WebAppResourceConfig} is created. Theinitialization 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 {@value 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 {@link 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 {@link ResourceConfig}.
A new {@link WebApplication} instance will be created and configured suchthat the following classes may be injected onto a root resource, provider and {@link Application} classes using {@link javax.ws.rs.core.Context}: {@link HttpServletRequest}, {@link HttpServletResponse}, {@link ServletContext}, {@link ServletConfig} and {@link WebConfig}. If this class is used as a Servlet then the {@link ServletConfig} class maybe injected. If this class is used as a Filter then the {@link FilterConfig}class may be injected. {@link WebConfig} may be injected to abstractservlet or filter deployment.
A {@link IoCComponentProviderFactory} instance may be registered by extending this classand overriding the method {@link #initiate(ResourceConfig,WebApplication)}to initiate the {@link WebApplication} with the {@link IoCComponentProviderFactory}instance.