## com.sun.jersey.api.core
Class DefaultResourceConfig

    java.lang.Object
      javax.ws.rs.core.Application
          com.sun.jersey.api.core.ResourceConfig
              com.sun.jersey.api.core.DefaultResourceConfig

All Implemented Interfaces:
  FeaturesAndProperties

Direct Known Subclasses:
  ApplicationAdapter, ClassNamesResourceConfig, ScanningResourceConfig

    public class DefaultResourceConfig

extends ResourceConfig

A mutable implementation of `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.

Field Summary

Fields inherited from class com.sun.jersey.api.core.ResourceConfig

`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_CONFIG`

Fields inherited from interface com.sun.jersey.core.util.FeaturesAndProperties
`FEATURE_DISABLE_XML_SECURITY, FEATURE_FORMATTED, FEATURE_PRE_1_4_PROVIDER_PRECEDENCE, FEATURE_XMLROOTELEMENT_PROCESSING`

Constructor Summary
`DefaultResourceConfig()`
`DefaultResourceConfig(java.lang.Class<?>... classes)`
`DefaultResourceConfig(java.util.Set<java.lang.Class<?>> classes)`

Method Summary
`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.

Methods inherited from class com.sun.jersey.api.core.ResourceConfig
`add, clone, getContainerRequestFilters, getContainerResponseFilters, getElements, getElements, getProviderClasses, getProviderSingletons, getResourceFilterFactories, getRootResourceClasses, getRootResourceSingletons, isProviderClass, isRootResourceClass, setPropertiesAndFeatures, validate`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultResourceConfig

    public DefaultResourceConfig()

### DefaultResourceConfig

    public DefaultResourceConfig(java.lang.Class<?>... classes)

Parameters:
  `classes` - the initial set of root resource classes and provider classes

### DefaultResourceConfig

    public DefaultResourceConfig(java.util.Set<java.lang.Class<?>> classes)

Parameters:
  `classes` - the initial set of root resource classes and provider classes

Method Detail

### getClasses

    public java.util.Set<java.lang.Class<?>> getClasses()

  Description copied from class: `Application`
  Get a set of root resource and provider classes. The default lifecycle for resource class instances is per-request. The default lifecycle for providers is singleton.

  Implementations 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.

  Overrides:
    `getClasses` in class `Application`
  Returns:
    a set of root resource and provider classes. Returning null is equivalent to returning an empty set.

### getSingletons

    public java.util.Set<java.lang.Object> getSingletons()

  Description copied from class: `Application`
  Get a set of root resource and provider 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.

  Overrides:
    `getSingletons` in class `Application`
  Returns:
    a set of root resource and provider instances. Returning null is equivalent to returning an empty set.

### getMediaTypeMappings

    public java.util.Map<java.lang.String,MediaType> getMediaTypeMappings()

  Description copied from class: `ResourceConfig`
  Get a map of file extension to media type. This is used to drive URI-based content negotiation such that, e.g.:

      GET /resource.atom

  is equivalent to:

      GET /resource
      Accept: application/atom+xml

  The default implementation returns an empty map.

  Overrides:
    `getMediaTypeMappings` in class `ResourceConfig`
  Returns:
    a map of file extension to media type

### getLanguageMappings

    public java.util.Map<java.lang.String,java.lang.String> getLanguageMappings()

  Description copied from class: `ResourceConfig`
  Get a map of file extension to language. This is used to drive URI-based content negotiation such that, e.g.:

      GET /resource.english

  is equivalent to:

      GET /resource
      Accept-Language: en

  The default implementation returns an empty map.

  Overrides:
    `getLanguageMappings` in class `ResourceConfig`
  Returns:
    a map of file extension to language

### getExplicitRootResources

    public java.util.Map<java.lang.String,java.lang.Object> getExplicitRootResources()

  Description copied from class: `ResourceConfig`
  Get a map of explicit root resource classes and root resource singleton instances. The default lifecycle for root resource class instances is per-request.

  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());

  Overrides:
    `getExplicitRootResources` in class `ResourceConfig`
  Returns:
    a map of explicit root resource classes and root resource singleton instances.

### getFeatures

    public java.util.Map<java.lang.String,java.lang.Boolean> getFeatures()

  Description copied from class: `ResourceConfig`
  Get the map of features associated with the Web application.

  Specified by:
    `getFeatures` in interface `FeaturesAndProperties`
  Specified by:
    `getFeatures` in class `ResourceConfig`
  Returns:
    the features. The returned value shall never be null.

### getFeature

    public boolean getFeature(java.lang.String featureName)

  Description copied from class: `ResourceConfig`
  Get the value of a feature.

  Specified by:
    `getFeature` in interface `FeaturesAndProperties`
  Specified by:
    `getFeature` in class `ResourceConfig`
  Parameters:
    `featureName` - the feature name.
  Returns:
    true if the feature is present and set to true, otherwise false if the feature is present and set to false or the feature is not present.

### getProperties

    public java.util.Map<java.lang.String,java.lang.Object> getProperties()

  Description copied from class: `ResourceConfig`
  Get the map of properties associated with the Web application.

  Specified by:
    `getProperties` in interface `FeaturesAndProperties`
  Specified by:
    `getProperties` in class `ResourceConfig`
  Returns:
    the properties. The returned value shall never be null.

### getProperty

    public java.lang.Object getProperty(java.lang.String propertyName)

  Description copied from class: `ResourceConfig`
  Get the value of a property.

  Specified by:
    `getProperty` in interface `FeaturesAndProperties`
  Specified by:
    `getProperty` in class `ResourceConfig`
  Parameters:
    `propertyName` - the property name.
  Returns:
    the property, or null if there is no property present for the given property name.

Copyright © 2017 Oracle Corporation. All Rights Reserved.