|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.ws.rs.core.Application
org.glassfish.jersey.server.ResourceConfig
public class ResourceConfig
The resource configuration for configuring a web application.
| Constructor Summary | |
|---|---|
ResourceConfig()
Create a new resource configuration without any custom properties or resource and provider classes. |
|
ResourceConfig(Class<?>... classes)
Create a new resource configuration initialized with a given set of resource/provider classes. |
|
ResourceConfig(ResourceConfig original)
Create a defensive resource configuration copy initialized with a given ResourceConfig. |
|
ResourceConfig(Set<Class<?>> classes)
Create a new resource configuration initialized with a given set of resource/provider classes. |
|
| Method Summary | |
|---|---|
ResourceConfig |
addProperties(Map<String,Object> properties)
Add properties to ResourceConfig. |
ResourceConfig |
files(boolean recursive,
String... files)
Adds array of file and directory names to scan for components. |
ResourceConfig |
files(String... files)
Adds array of file and directory names to scan for components. |
static ResourceConfig |
forApplication(javax.ws.rs.core.Application application)
Returns a ResourceConfig instance for the supplied application. |
static ResourceConfig |
forApplicationClass(Class<? extends javax.ws.rs.core.Application> applicationClass)
Returns a ResourceConfig instance wrapping the application of the supplied class. |
static ResourceConfig |
forApplicationClass(Class<? extends javax.ws.rs.core.Application> applicationClass,
Set<Class<?>> defaultClasses)
Returns a ResourceConfig instance wrapping the application of the supplied class. |
javax.ws.rs.core.Application |
getApplication()
Returns JAX-RS application corresponding with this ResourceConfig. |
String |
getApplicationName()
Get the name of the Jersey application. |
Set<Class<?>> |
getClasses()
|
ClassLoader |
getClassLoader()
Get resource and provider class loader. |
ServerConfig |
getConfiguration()
|
Map<Class<?>,Integer> |
getContracts(Class<?> componentClass)
|
Set<Object> |
getInstances()
|
Map<String,Object> |
getProperties()
|
Object |
getProperty(String name)
|
Collection<String> |
getPropertyNames()
|
Set<Resource> |
getResources()
Get programmatically modeled resources. |
javax.ws.rs.RuntimeType |
getRuntimeType()
|
Set<Object> |
getSingletons()
|
boolean |
isEnabled(Class<? extends javax.ws.rs.core.Feature> featureClass)
|
boolean |
isEnabled(javax.ws.rs.core.Feature feature)
|
boolean |
isProperty(String name)
|
boolean |
isRegistered(Class<?> componentClass)
|
boolean |
isRegistered(Object component)
|
ResourceConfig |
packages(boolean recursive,
String... packages)
Adds array of package names which will be used to scan for components. |
ResourceConfig |
packages(String... packages)
Adds array of package names which will be used to scan for components. |
ResourceConfig |
property(String name,
Object value)
|
ResourceConfig |
register(Class<?> componentClass)
|
ResourceConfig |
register(Class<?> componentClass,
Class<?>... contracts)
|
ResourceConfig |
register(Class<?> componentClass,
int bindingPriority)
|
ResourceConfig |
register(Class<?> componentClass,
Map<Class<?>,Integer> contracts)
|
ResourceConfig |
register(Object component)
|
ResourceConfig |
register(Object component,
Class<?>... contracts)
|
ResourceConfig |
register(Object component,
int bindingPriority)
|
ResourceConfig |
register(Object component,
Map<Class<?>,Integer> contracts)
|
ResourceConfig |
registerClasses(Class<?>... classes)
Register annotated JAX-RS resource, JAX-RS or Jersey contract provider or JAX-RS feature in the ResourceConfig. |
ResourceConfig |
registerClasses(Set<Class<?>> classes)
Register annotated JAX-RS resource, JAX-RS or Jersey contract provider or JAX-RS feature in the ResourceConfig. |
ResourceConfig |
registerFinder(ResourceFinder resourceFinder)
Add a ResourceFinder to ResourceConfig. |
ResourceConfig |
registerInstances(Object... instances)
Register annotated JAX-RS resource, JAX-RS or Jersey contract provider, JAX-RS feature or HK2 binder instances (singletons) in the ResourceConfig. |
ResourceConfig |
registerInstances(Set<Object> instances)
Register annotated JAX-RS resource, JAX-RS or Jersey contract provider, JAX-RS feature or HK2 binder instances (singletons) in the ResourceConfig. |
ResourceConfig |
registerResources(Resource... resources)
Register new programmatic resource models in the ResourceConfig. |
ResourceConfig |
registerResources(Set<Resource> resources)
Register new resource models in the ResourceConfig. |
void |
setApplicationName(String applicationName)
Set the name of the application. |
ResourceConfig |
setClassLoader(ClassLoader classLoader)
Set ClassLoader which will be used for resource discovery. |
ResourceConfig |
setProperties(Map<String,?> properties)
Set new configuration properties replacing all previously set properties. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceConfig()
public ResourceConfig(Set<Class<?>> classes)
classes - application-specific resource and/or provider classes.public ResourceConfig(Class<?>... classes)
classes - application-specific resource and/or provider classes.public ResourceConfig(ResourceConfig original)
ResourceConfig.
original - resource configuration to create a defensive copy from.| Method Detail |
|---|
public static ResourceConfig forApplication(javax.ws.rs.core.Application application)
ResourceConfig instance for the supplied application.
If the application is an instance of ResourceConfig the method returns defensive copy of the resource config.
Otherwise it creates a new ResourceConfig from the application.
application - Application to provide the ResourceConfig instance for.
public static ResourceConfig forApplicationClass(Class<? extends javax.ws.rs.core.Application> applicationClass)
ResourceConfig instance wrapping the application of the supplied class.
applicationClass - Class representing a JAX-RS application.
public static ResourceConfig forApplicationClass(Class<? extends javax.ws.rs.core.Application> applicationClass,
Set<Class<?>> defaultClasses)
ResourceConfig instance wrapping the application of the supplied class.
This method provides an option of supplying the set of classes that should be returned from getClasses()
method if the application defined by the supplied application class returns empty sets from .Application#getClasses()
and Application.getSingletons() methods.
applicationClass - Class representing a JAX-RS application.defaultClasses - Default set of classes that should be returned from getClasses() if the underlying
application does not provide any classes and singletons.
public final ResourceConfig addProperties(Map<String,Object> properties)
ResourceConfig.
If any of the added properties exists already, he values of the existing
properties will be replaced with new values.
properties - properties to add.
public ResourceConfig setProperties(Map<String,?> properties)
properties - new set of configuration properties. The content of
the map will replace any existing properties set on the configuration
instance.
public ResourceConfig property(String name,
Object value)
property in interface javax.ws.rs.core.Configurable<ResourceConfig>public ResourceConfig register(Class<?> componentClass)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>
public ResourceConfig register(Class<?> componentClass,
int bindingPriority)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>
public ResourceConfig register(Class<?> componentClass,
Class<?>... contracts)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>
public ResourceConfig register(Class<?> componentClass,
Map<Class<?>,Integer> contracts)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>public ResourceConfig register(Object component)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>
public ResourceConfig register(Object component,
int bindingPriority)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>
public ResourceConfig register(Object component,
Class<?>... contracts)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>
public ResourceConfig register(Object component,
Map<Class<?>,Integer> contracts)
register in interface javax.ws.rs.core.Configurable<ResourceConfig>public final ResourceConfig registerClasses(Set<Class<?>> classes)
ResourceConfig.
Note that registered JAX-RS features are used to initialize and configure
the Jersey runtime ServiceLocator instance during application deployment, but are
otherwise ignored by server-side runtime, unless they implement also another contract
recognized by Jersey runtime.
Also note that registration of HK2 binder classes is note supported. HK2 binders
must be registered as instances.
classes - classes to register.
public final ResourceConfig registerClasses(Class<?>... classes)
ResourceConfig.
Note that registered JAX-RS features are used to initialize and configure
the Jersey runtime ServiceLocator instance during application deployment, but are
otherwise ignored by server-side runtime, unless they implement also another contract
recognized by Jersey runtime.
Also note that registration of HK2 binder classes is note supported. HK2 binders
must be registered as instances.
classes - classes to register.
public final ResourceConfig registerInstances(Set<Object> instances)
HK2 binder instances (singletons) in the ResourceConfig.
Note that registered HK2 binders and JAX-RS features are used to initialize and configure
the Jersey runtime ServiceLocator instance during application deployment, but are
otherwise ignored by server-side runtime, unless they implement also another contract
recognized by Jersey runtime.
instances - instances to register.
public final ResourceConfig registerInstances(Object... instances)
HK2 binder instances (singletons) in the ResourceConfig.
Note that registered HK2 binders and JAX-RS features are used to initialize and configure
the Jersey runtime ServiceLocator instance during application deployment, but are
otherwise ignored by server-side runtime, unless they implement also another contract
recognized by Jersey runtime.
instances - instances to register.
public final ResourceConfig registerResources(Resource... resources)
ResourceConfig.
resources - resource models to register.
public final ResourceConfig registerResources(Set<Resource> resources)
ResourceConfig.
resources - resource models to register.
public final ResourceConfig registerFinder(ResourceFinder resourceFinder)
ResourceFinder to ResourceConfig.
resourceFinder - ResourceFinder
public final void setApplicationName(String applicationName)
applicationName - Unique application name.public final ResourceConfig setClassLoader(ClassLoader classLoader)
ClassLoader which will be used for resource discovery.
classLoader - provided ClassLoader.
public final ResourceConfig packages(String... packages)
packages - array of package names.
packages(boolean, String...)
public final ResourceConfig packages(boolean recursive,
String... packages)
recursive - defines whether any nested packages in the collection of specified
package names should be recursively scanned (value of true)
as part of the package scanning or not (value of false).packages - array of package names.
packages(String...)public final ResourceConfig files(String... files)
files - array of file and directory names.
public final ResourceConfig files(boolean recursive,
String... files)
recursive - defines whether any sub-directories of the directories specified
in the collection of file names should be recursively scanned (value of true)
as part of the file scanning or not (value of false).files - array of file and directory names.
public final ServerConfig getConfiguration()
getConfiguration in interface javax.ws.rs.core.Configurable<ResourceConfig>public final Map<String,Object> getProperties()
getProperties in interface javax.ws.rs.core.ConfigurationgetProperties in class javax.ws.rs.core.Applicationpublic final Object getProperty(String name)
getProperty in interface javax.ws.rs.core.Configurationpublic Collection<String> getPropertyNames()
getPropertyNames in interface javax.ws.rs.core.Configurationpublic final boolean isProperty(String name)
isProperty in interface ExtendedConfigpublic final Set<Class<?>> getClasses()
getClasses in interface javax.ws.rs.core.ConfigurationgetClasses in class javax.ws.rs.core.Applicationpublic final Set<Object> getInstances()
getInstances in interface javax.ws.rs.core.Configurationpublic final Set<Object> getSingletons()
getSingletons in class javax.ws.rs.core.Applicationpublic javax.ws.rs.RuntimeType getRuntimeType()
getRuntimeType in interface javax.ws.rs.core.Configurationpublic boolean isEnabled(javax.ws.rs.core.Feature feature)
isEnabled in interface javax.ws.rs.core.Configurationpublic boolean isEnabled(Class<? extends javax.ws.rs.core.Feature> featureClass)
isEnabled in interface javax.ws.rs.core.Configurationpublic boolean isRegistered(Object component)
isRegistered in interface javax.ws.rs.core.Configurationpublic boolean isRegistered(Class<?> componentClass)
isRegistered in interface javax.ws.rs.core.Configurationpublic Map<Class<?>,Integer> getContracts(Class<?> componentClass)
getContracts in interface javax.ws.rs.core.Configurationpublic final Set<Resource> getResources()
ServerConfig
getResources in interface ServerConfigpublic final ClassLoader getClassLoader()
public final javax.ws.rs.core.Application getApplication()
public String getApplicationName()
setApplicationName(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||