public class Application
extends java.lang.Object
The implementation-created instance of an Application subclass may be injected into resource classes and providers
using Context
.
In case any of the Application
subclass methods or it's constructor throws a RuntimeException
, the
deployment of the application SHOULD be aborted with a failure.
Constructor and Description |
---|
Application() |
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.lang.Class<?>> |
getClasses()
Get a set of root resource, provider and
feature classes. |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Get a map of custom application-wide properties.
|
java.util.Set<java.lang.Object> |
getSingletons()
Deprecated.
Automatic discovery of resources and providers or the
getClasses method is preferred over
getSingletons . |
public java.util.Set<java.lang.Class<?>> getClasses()
feature
classes.
The default life-cycle for resource class instances is per-request. The default life-cycle for providers (registered
directly or via a feature) is singleton.
Implementations should warn about and ignore classes that do not conform to the requirements of root resource or
provider/feature classes. Implementations should warn about and ignore classes for which getSingletons()
returns an instance. Implementations MUST NOT modify the returned set.
The default implementation returns an empty set.
null
is equivalent to returning an empty set.@Deprecated public java.util.Set<java.lang.Object> getSingletons()
getClasses
method is preferred over
getSingletons
.feature
instances.
Fields and properties of returned instances are injected with their declared dependencies (see Context
) by
the runtime prior to use.
Implementations should warn about and ignore classes that do not conform to the requirements of root resource or provider classes. Implementations should flag an error if the returned set includes more than one instance of the same class. Implementations MUST NOT modify the returned set.
The default implementation returns an empty set.
null
is equivalent to returning an empty
set.public java.util.Map<java.lang.String,java.lang.Object> getProperties()
The returned properties are reflected in the application configuration
passed to the
server-side features or injected into server-side JAX-RS components.
The set of returned properties may be further extended or customized at deployment time using container-specific
features and deployment descriptors. For example, in a Servlet-based deployment scenario, web application's
<context-param>
and Servlet <init-param>
values may be used to extend or override values of the
properties programmatically returned by this method.
The default implementation returns an empty set.
null
is equivalent to returning an empty set.