Package org.jboss.resteasy.core
Class ResourceMethodRegistry
- java.lang.Object
-
- org.jboss.resteasy.core.ResourceMethodRegistry
-
-
Field Summary
Fields Modifier and Type Field Description protected ResteasyProviderFactoryproviderFactorystatic java.lang.StringREGISTRY_MATCHING_EXCEPTIONprotected RootClassNoderootprotected RootNoderootNodeprotected booleanwiderMatching
-
Constructor Summary
Constructors Constructor Description ResourceMethodRegistry(ResteasyProviderFactory providerFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJndiResource(java.lang.String jndiName)Add a JAX-RS endpoint that exists in JNDIvoidaddJndiResource(java.lang.String jndiName, java.lang.String basePath)Add a JAX-RS endpoint that exists in JNDI.voidaddJndiResource(java.lang.String jndiName, ResourceClass resourceClass)voidaddJndiResource(java.lang.String jndiName, ResourceClass resourceClass, java.lang.String basePath)voidaddPerRequestResource(java.lang.Class clazz)Register a vanilla JAX-RS resource classvoidaddPerRequestResource(java.lang.Class clazz, java.lang.String basePath)Add a JAX-RS endpoint.voidaddPerRequestResource(ResourceClass clazz)voidaddPerRequestResource(ResourceClass clazz, java.lang.String basePath)voidaddResourceFactory(ResourceFactory ref)Bind an endpoint ResourceFactory.voidaddResourceFactory(ResourceFactory ref, java.lang.String base)ResourceFactory.getScannableClass() defines what class should be scanned for JAX-RS annotations.voidaddResourceFactory(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.voidaddResourceFactory(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.voidaddResourceFactory(ResourceFactory rf, java.lang.String base, ResourceClass resourceClass)voidaddSingletonResource(java.lang.Object singleton)Add a JAX-RS endpoint.voidaddSingletonResource(java.lang.Object singleton, java.lang.String basePath)Add a JAX-RS endpoint.voidaddSingletonResource(java.lang.Object singleton, ResourceClass resourceClass)voidaddSingletonResource(java.lang.Object singleton, ResourceClass resourceClass, java.lang.String basePath)voidcheckAmbiguousUri()Resteasy 2.x does not properly handle sub-resource and sub-resource locator endpoints with the same uri.private java.lang.reflect.MethodfindAnnotatedInterfaceMethod(java.lang.Class<?> root, java.lang.Class<?> iface, java.lang.reflect.Method implementation)private java.lang.reflect.MethodfindAnnotatedMethod(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)ResourceInvokergetResourceInvoker(HttpRequest request)Find a resource to invoke onintgetSize()Number of endpoints registeredbooleanisWiderMatching()protected voidprocessMethod(ResourceFactory rf, java.lang.String base, ResourceLocator method)protected voidregister(ResourceFactory rf, java.lang.String base, ResourceClass resourceClass)private voidremoveRegistration(java.lang.String base, java.lang.Class<?> clazz)voidremoveRegistrations(java.lang.Class clazz)Find all endpoints reachable by clazz and unregister themvoidremoveRegistrations(java.lang.Class clazz, java.lang.String base)voidremoveRegistrations(ResourceClass resourceClass)voidsetWiderMatching(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:RegistryAdd a JAX-RS endpoint. Objects of clazz will be created and destroy and the beginning/end of every request- Specified by:
addPerRequestResourcein interfaceRegistrybasePath- prefix path of resource
-
addPerRequestResource
public void addPerRequestResource(java.lang.Class clazz)
Register a vanilla JAX-RS resource class- Specified by:
addPerRequestResourcein interfaceRegistry- Parameters:
clazz-
-
addPerRequestResource
public void addPerRequestResource(ResourceClass clazz)
- Specified by:
addPerRequestResourcein interfaceRegistry
-
addPerRequestResource
public void addPerRequestResource(ResourceClass clazz, java.lang.String basePath)
- Specified by:
addPerRequestResourcein interfaceRegistry
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton)
Description copied from interface:RegistryAdd a JAX-RS endpoint.- Specified by:
addSingletonResourcein interfaceRegistry
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton, java.lang.String basePath)Description copied from interface:RegistryAdd a JAX-RS endpoint.- Specified by:
addSingletonResourcein interfaceRegistrybasePath- prefix path of resource
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton, ResourceClass resourceClass)- Specified by:
addSingletonResourcein interfaceRegistry
-
addSingletonResource
public void addSingletonResource(java.lang.Object singleton, ResourceClass resourceClass, java.lang.String basePath)- Specified by:
addSingletonResourcein interfaceRegistry
-
addJndiResource
public void addJndiResource(java.lang.String jndiName)
Description copied from interface:RegistryAdd a JAX-RS endpoint that exists in JNDI- Specified by:
addJndiResourcein interfaceRegistry
-
addJndiResource
public void addJndiResource(java.lang.String jndiName, java.lang.String basePath)Description copied from interface:RegistryAdd a JAX-RS endpoint that exists in JNDI.- Specified by:
addJndiResourcein interfaceRegistrybasePath- prefix path of resource
-
addJndiResource
public void addJndiResource(java.lang.String jndiName, ResourceClass resourceClass)- Specified by:
addJndiResourcein interfaceRegistry
-
addJndiResource
public void addJndiResource(java.lang.String jndiName, ResourceClass resourceClass, java.lang.String basePath)- Specified by:
addJndiResourcein 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:
addResourceFactoryin 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:
addResourceFactoryin 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:
addResourceFactoryin 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:
addResourceFactoryin 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:
addResourceFactoryin 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:
checkAmbiguousUriin 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:
removeRegistrationsin interfaceRegistry- Parameters:
clazz-
-
removeRegistrations
public void removeRegistrations(java.lang.Class clazz, java.lang.String base)- Specified by:
removeRegistrationsin interfaceRegistry
-
removeRegistrations
public void removeRegistrations(ResourceClass resourceClass)
- Specified by:
removeRegistrationsin 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:
getResourceInvokerin interfaceRegistry- Returns:
-
-