Package org.jboss.resteasy.core
Class ResourceMethodRegistry
- java.lang.Object
-
- org.jboss.resteasy.core.ResourceMethodRegistry
-
-
Field Summary
Fields Modifier and Type Field Description protected ResteasyProviderFactory
providerFactory
static java.lang.String
REGISTRY_MATCHING_EXCEPTION
protected RootClassNode
root
protected RootNode
rootNode
protected boolean
widerMatching
-
Constructor Summary
Constructors Constructor Description ResourceMethodRegistry(ResteasyProviderFactory providerFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addJndiResource(java.lang.String jndiName)
Add a JAX-RS endpoint that exists in JNDIvoid
addJndiResource(java.lang.String jndiName, java.lang.String basePath)
Add a JAX-RS endpoint that exists in JNDI.void
addJndiResource(java.lang.String jndiName, ResourceClass resourceClass)
void
addJndiResource(java.lang.String jndiName, ResourceClass resourceClass, java.lang.String basePath)
void
addPerRequestResource(java.lang.Class clazz)
Register a vanilla JAX-RS resource classvoid
addPerRequestResource(java.lang.Class clazz, java.lang.String basePath)
Add a JAX-RS endpoint.void
addPerRequestResource(ResourceClass clazz)
void
addPerRequestResource(ResourceClass clazz, java.lang.String basePath)
void
addResourceFactory(ResourceFactory ref)
Bind an endpoint ResourceFactory.void
addResourceFactory(ResourceFactory ref, java.lang.String base)
ResourceFactory.getScannableClass() defines what class should be scanned for JAX-RS annotations.void
addResourceFactory(ResourceFactory ref, java.lang.String base, java.lang.Class<?> clazz)
ResourceFactory.getScannableClass() is not used, only the clazz parameter and not any implemented interfaces of the clazz parameter.void
addResourceFactory(ResourceFactory ref, java.lang.String base, java.lang.Class<?>[] classes)
ResourceFactory.getScannableClass() is not used, only the clazz parameter and not any implemented interfaces of the clazz parameter.void
addResourceFactory(ResourceFactory rf, java.lang.String base, ResourceClass resourceClass)
void
addSingletonResource(java.lang.Object singleton)
Add a JAX-RS endpoint.void
addSingletonResource(java.lang.Object singleton, java.lang.String basePath)
Add a JAX-RS endpoint.void
addSingletonResource(java.lang.Object singleton, ResourceClass resourceClass)
void
addSingletonResource(java.lang.Object singleton, ResourceClass resourceClass, java.lang.String basePath)
void
checkAmbiguousUri()
Resteasy 2.x does not properly handle sub-resource and sub-resource locator endpoints with the same uri.private java.lang.reflect.Method
findAnnotatedInterfaceMethod(java.lang.Class<?> root, java.lang.Class<?> iface, java.lang.reflect.Method implementation)
private java.lang.reflect.Method
findAnnotatedMethod(java.lang.Class<?> root, java.lang.reflect.Method implementation)
java.util.Map<java.lang.String,java.util.List<ResourceInvoker>>
getBounded()
private java.lang.reflect.Method[]
getDeclaredMethods(java.lang.Class<?> clazz)
ResourceInvoker
getResourceInvoker(HttpRequest request)
Find a resource to invoke onint
getSize()
Number of endpoints registeredboolean
isWiderMatching()
protected void
processMethod(ResourceFactory rf, java.lang.String base, ResourceLocator method)
protected void
register(ResourceFactory rf, java.lang.String base, ResourceClass resourceClass)
private void
removeRegistration(java.lang.String base, java.lang.Class<?> clazz)
void
removeRegistrations(java.lang.Class clazz)
Find all endpoints reachable by clazz and unregister themvoid
removeRegistrations(java.lang.Class clazz, java.lang.String base)
void
removeRegistrations(ResourceClass resourceClass)
void
setWiderMatching(boolean widerMatching)
-
-
-
Field Detail
-
REGISTRY_MATCHING_EXCEPTION
public static final java.lang.String REGISTRY_MATCHING_EXCEPTION
- See Also:
- Constant Field Values
-
providerFactory
protected ResteasyProviderFactory providerFactory
-
root
protected RootClassNode root
-
widerMatching
protected boolean widerMatching
-
rootNode
protected RootNode rootNode
-
-
Constructor Detail
-
ResourceMethodRegistry
public ResourceMethodRegistry(ResteasyProviderFactory providerFactory)
-
-
Method Detail
-
isWiderMatching
public boolean isWiderMatching()
-
setWiderMatching
public void setWiderMatching(boolean widerMatching)
-
addPerRequestResource
public void addPerRequestResource(java.lang.Class clazz, java.lang.String basePath)
Description copied from interface:Registry
Add a JAX-RS endpoint. Objects of clazz will be created and destroy and the beginning/end of every request- Specified by:
addPerRequestResource
in interfaceRegistry
basePath
- prefix path of resource
-
addPerRequestResource
public void addPerRequestResource(java.lang.Class clazz)
Register a vanilla JAX-RS resource class- Specified by:
addPerRequestResource
in interfaceRegistry
- Parameters:
clazz
-
-
addPerRequestResource
public void addPerRequestResource(ResourceClass clazz)
- Specified by:
addPerRequestResource
in interfaceRegistry
-
addPerRequestResource
public void addPerRequestResource(ResourceClass clazz, java.lang.String basePath)
- Specified by:
addPerRequestResource
in interfaceRegistry
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton)
Description copied from interface:Registry
Add a JAX-RS endpoint.- Specified by:
addSingletonResource
in interfaceRegistry
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton, java.lang.String basePath)
Description copied from interface:Registry
Add a JAX-RS endpoint.- Specified by:
addSingletonResource
in interfaceRegistry
basePath
- prefix path of resource
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton, ResourceClass resourceClass)
- Specified by:
addSingletonResource
in interfaceRegistry
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton, ResourceClass resourceClass, java.lang.String basePath)
- Specified by:
addSingletonResource
in interfaceRegistry
-
addJndiResource
public void addJndiResource(java.lang.String jndiName)
Description copied from interface:Registry
Add a JAX-RS endpoint that exists in JNDI- Specified by:
addJndiResource
in interfaceRegistry
-
addJndiResource
public void addJndiResource(java.lang.String jndiName, java.lang.String basePath)
Description copied from interface:Registry
Add a JAX-RS endpoint that exists in JNDI.- Specified by:
addJndiResource
in interfaceRegistry
basePath
- prefix path of resource
-
addJndiResource
public void addJndiResource(java.lang.String jndiName, ResourceClass resourceClass)
- Specified by:
addJndiResource
in interfaceRegistry
-
addJndiResource
public void addJndiResource(java.lang.String jndiName, ResourceClass resourceClass, java.lang.String basePath)
- Specified by:
addJndiResource
in interfaceRegistry
-
addResourceFactory
public void addResourceFactory(ResourceFactory ref)
Bind an endpoint ResourceFactory. ResourceFactory.getScannableClass() defines what class should be scanned for JAX-RS annotations. The class and any implemented interfaces are scanned for annotations.- Specified by:
addResourceFactory
in interfaceRegistry
- Parameters:
ref
-
-
addResourceFactory
public void addResourceFactory(ResourceFactory ref, java.lang.String base)
ResourceFactory.getScannableClass() defines what class should be scanned for JAX-RS annotations. The class and any implemented interfaces are scanned for annotations.- Specified by:
addResourceFactory
in interfaceRegistry
- Parameters:
ref
-base
- base URI path for any resources provided by the factory, in addition to rootPath
-
addResourceFactory
public void addResourceFactory(ResourceFactory ref, java.lang.String base, java.lang.Class<?> clazz)
ResourceFactory.getScannableClass() is not used, only the clazz parameter and not any implemented interfaces of the clazz parameter.- Specified by:
addResourceFactory
in interfaceRegistry
- Parameters:
ref
-base
- base URI path for any resources provided by the factory, in addition to rootPathclazz
- specific class
-
addResourceFactory
public void addResourceFactory(ResourceFactory ref, java.lang.String base, java.lang.Class<?>[] classes)
ResourceFactory.getScannableClass() is not used, only the clazz parameter and not any implemented interfaces of the clazz parameter.- Specified by:
addResourceFactory
in interfaceRegistry
- Parameters:
ref
-base
- base URI path for any resources provided by the factory, in addition to rootPathclasses
- specific class
-
getDeclaredMethods
private java.lang.reflect.Method[] getDeclaredMethods(java.lang.Class<?> clazz)
-
addResourceFactory
public void addResourceFactory(ResourceFactory rf, java.lang.String base, ResourceClass resourceClass)
- Specified by:
addResourceFactory
in interfaceRegistry
-
register
protected void register(ResourceFactory rf, java.lang.String base, ResourceClass resourceClass)
-
checkAmbiguousUri
public void checkAmbiguousUri()
Resteasy 2.x does not properly handle sub-resource and sub-resource locator endpoints with the same uri. Resteasy 3.x does handle this properly. In assisting customers identify this issue during an upgrade from Resteasy 2 to 3 provides a waring when the situation is found.- Specified by:
checkAmbiguousUri
in interfaceRegistry
-
processMethod
protected void processMethod(ResourceFactory rf, java.lang.String base, ResourceLocator method)
-
findAnnotatedInterfaceMethod
private java.lang.reflect.Method findAnnotatedInterfaceMethod(java.lang.Class<?> root, java.lang.Class<?> iface, java.lang.reflect.Method implementation)
-
findAnnotatedMethod
private java.lang.reflect.Method findAnnotatedMethod(java.lang.Class<?> root, java.lang.reflect.Method implementation)
-
removeRegistrations
public void removeRegistrations(java.lang.Class clazz)
Find all endpoints reachable by clazz and unregister them- Specified by:
removeRegistrations
in interfaceRegistry
- Parameters:
clazz
-
-
removeRegistrations
public void removeRegistrations(java.lang.Class clazz, java.lang.String base)
- Specified by:
removeRegistrations
in interfaceRegistry
-
removeRegistrations
public void removeRegistrations(ResourceClass resourceClass)
- Specified by:
removeRegistrations
in interfaceRegistry
-
removeRegistration
private void removeRegistration(java.lang.String base, java.lang.Class<?> clazz)
-
getBounded
public java.util.Map<java.lang.String,java.util.List<ResourceInvoker>> getBounded()
-
getSize
public int getSize()
Number of endpoints registered
-
getResourceInvoker
public ResourceInvoker getResourceInvoker(HttpRequest request)
Find a resource to invoke on- Specified by:
getResourceInvoker
in interfaceRegistry
- Returns:
-
-