public class DefaultResourceConfig extends ResourceConfig
ResourceConfig that declares
default values for features.
The set of features and properties may be modified by modifying the instances
returned from the methods ResourceConfig.getFeatures() and
ResourceConfig.getProperties() respectively.
COMMON_DELIMITERS, FEATURE_CANONICALIZE_URI_PATH, FEATURE_DISABLE_WADL, FEATURE_IMPLICIT_VIEWABLES, FEATURE_MATCH_MATRIX_PARAMS, FEATURE_NORMALIZE_URI, FEATURE_REDIRECT, FEATURE_TRACE, FEATURE_TRACE_PER_REQUEST, PROPERTY_CONTAINER_NOTIFIER, PROPERTY_CONTAINER_REQUEST_FILTERS, PROPERTY_CONTAINER_RESPONSE_FILTERS, PROPERTY_DEFAULT_RESOURCE_COMPONENT_PROVIDER_FACTORY_CLASS, PROPERTY_LANGUAGE_MAPPINGS, PROPERTY_MEDIA_TYPE_MAPPINGS, PROPERTY_RESOURCE_FILTER_FACTORIES, PROPERTY_WADL_GENERATOR_CONFIGFEATURE_DISABLE_XML_SECURITY, FEATURE_FORMATTED, FEATURE_PRE_1_4_PROVIDER_PRECEDENCE, FEATURE_XMLROOTELEMENT_PROCESSING| Constructor and Description |
|---|
DefaultResourceConfig() |
DefaultResourceConfig(java.lang.Class<?>... classes) |
DefaultResourceConfig(java.util.Set<java.lang.Class<?>> classes) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.Class<?>> |
getClasses()
Get a set of root resource and provider classes.
|
java.util.Map<java.lang.String,java.lang.Object> |
getExplicitRootResources()
Get a map of explicit root resource classes and root resource singleton
instances.
|
boolean |
getFeature(java.lang.String featureName)
Get the value of a feature.
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getFeatures()
Get the map of features associated with the Web application.
|
java.util.Map<java.lang.String,java.lang.String> |
getLanguageMappings()
Get a map of file extension to language.
|
java.util.Map<java.lang.String,MediaType> |
getMediaTypeMappings()
Get a map of file extension to media type.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Get the map of properties associated with the Web application.
|
java.lang.Object |
getProperty(java.lang.String propertyName)
Get the value of a property.
|
java.util.Set<java.lang.Object> |
getSingletons()
Get a set of root resource and provider instances.
|
add, clone, getContainerRequestFilters, getContainerResponseFilters, getElements, getElements, getProviderClasses, getProviderSingletons, getResourceFilterFactories, getRootResourceClasses, getRootResourceSingletons, isProviderClass, isRootResourceClass, setPropertiesAndFeatures, validatepublic DefaultResourceConfig()
public DefaultResourceConfig(java.lang.Class<?>... classes)
classes - the initial set of root resource classes
and provider classespublic DefaultResourceConfig(java.util.Set<java.lang.Class<?>> classes)
classes - the initial set of root resource classes
and provider classespublic java.util.Set<java.lang.Class<?>> getClasses()
ApplicationImplementations should warn about and ignore classes that do not
conform to the requirements of root resource or provider classes.
Implementations should warn about and ignore classes for which
Application.getSingletons() returns an instance. Implementations MUST
NOT modify the returned set.
The default implementation returns an empty set.
getClasses in class Applicationpublic java.util.Set<java.lang.Object> getSingletons()
ApplicationContext) 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.
getSingletons in class Applicationpublic java.util.Map<java.lang.String,MediaType> getMediaTypeMappings()
ResourceConfigGET /resource.atom
is equivalent to:
GET /resource Accept: application/atom+xml
The default implementation returns an empty map.
getMediaTypeMappings in class ResourceConfigpublic java.util.Map<java.lang.String,java.lang.String> getLanguageMappings()
ResourceConfigGET /resource.english
is equivalent to:
GET /resource Accept-Language: en
The default implementation returns an empty map.
getLanguageMappings in class ResourceConfigpublic java.util.Map<java.lang.String,java.lang.Object> getExplicitRootResources()
ResourceConfig
The root resource path template is declared using the key in the map. This
is a substitute for the declaration of a Path annotation on a root
resource class or singleton instance. The key has the same semantics as the
Path.value(). If such a Path annotation is present
it will be ignored.
For example, the following will register two root resources, first a root resource class at the path "class" and a root resource singleton at the path "singleton":
getExplicitRootResources().put("class", RootResourceClass.class);
getExplicitRootResources().put("singleton", new RootResourceSingleton());
getExplicitRootResources in class ResourceConfigpublic java.util.Map<java.lang.String,java.lang.Boolean> getFeatures()
ResourceConfiggetFeatures in interface FeaturesAndPropertiesgetFeatures in class ResourceConfigpublic boolean getFeature(java.lang.String featureName)
ResourceConfiggetFeature in interface FeaturesAndPropertiesgetFeature in class ResourceConfigfeatureName - the feature name.public java.util.Map<java.lang.String,java.lang.Object> getProperties()
ResourceConfiggetProperties in interface FeaturesAndPropertiesgetProperties in class ResourceConfigpublic java.lang.Object getProperty(java.lang.String propertyName)
ResourceConfiggetProperty in interface FeaturesAndPropertiesgetProperty in class ResourceConfigpropertyName - the property name.Copyright © 2016 Oracle Corporation. All Rights Reserved.