com.sun.jersey.api.core
Class DefaultResourceConfig

java.lang.Object
  extended by javax.ws.rs.core.Application
      extended by com.sun.jersey.api.core.ResourceConfig
          extended by com.sun.jersey.api.core.DefaultResourceConfig
Direct Known Subclasses:
ApplicationAdapter, ClasspathResourceConfig, PackagesResourceConfig

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
FEATURE_CANONICALIZE_URI_PATH, FEATURE_IMPLICIT_VIEWABLES, FEATURE_MATCH_MATRIX_PARAMS, FEATURE_NORMALIZE_URI, FEATURE_REDIRECT, PROPERTY_CONTAINER_NOTIFIER, PROPERTY_CONTAINER_REQUEST_FILTERS, PROPERTY_CONTAINER_RESPONSE_FILTERS, PROPERTY_DEFAULT_RESOURCE_PROVIDER_CLASS, PROPERTY_WADL_GENERATOR_CONFIG
 
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()
           
static java.lang.String[] getElements(java.lang.String[] elements)
          Get a cannonical array of String elements from a String array where each entry may contain zero or more elements separated by ';'.
 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,javax.ws.rs.core.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()
           
protected  void setPropertiesAndFeatures(java.util.Map<java.lang.String,java.lang.Object> entries)
          Set the properties and features given a map of entries.
 
Methods inherited from class com.sun.jersey.api.core.ResourceConfig
getProviderClasses, getProviderSingletons, getRootResourceClasses, getRootResourceSingletons, validate
 
Methods inherited from class java.lang.Object
clone, 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()
Specified by:
getClasses in class javax.ws.rs.core.Application

getSingletons

public java.util.Set<java.lang.Object> getSingletons()
Overrides:
getSingletons in class javax.ws.rs.core.Application

getMediaTypeMappings

public java.util.Map<java.lang.String,javax.ws.rs.core.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

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 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 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 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 class ResourceConfig
Parameters:
propertyName - the property name.
Returns:
the property, or null if there is no property present for the given property name.

setPropertiesAndFeatures

protected void setPropertiesAndFeatures(java.util.Map<java.lang.String,java.lang.Object> entries)
Set the properties and features given a map of entries.

Parameters:
entries - the map of entries. All entries are added as properties. Any entry with a value that is an instance of Boolean is added as a feature with the feature name set to the entry name and the feature value set to the entry value. Any entry with a value that is an instance String and is equal (ignoring case) to "true" or "false" is added as a feature with the feature name set to the entry name and the feature value set to the Boolean value of the entry value. Features are only added if an existing feature does not currently exist.

getElements

public static java.lang.String[] getElements(java.lang.String[] elements)
Get a cannonical array of String elements from a String array where each entry may contain zero or more elements separated by ';'.

Parameters:
elements - an array where each String entry may contain zero or more ';' separated elements.
Returns:
the array of elements, each element is trimmed, the array will not contain any empty or null entries.


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.