Class ResourceMethodRegistry

  • All Implemented Interfaces:
    Registry

    public class ResourceMethodRegistry
    extends java.lang.Object
    implements Registry
    Registry of resources and methods/classes that can dispatch HTTP method requests
    Version:
    $Revision: 1 $
    • 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 interface Registry
        basePath - prefix path of resource
      • addPerRequestResource

        public void addPerRequestResource​(java.lang.Class clazz)
        Register a vanilla JAX-RS resource class
        Specified by:
        addPerRequestResource in interface Registry
        Parameters:
        clazz -
      • addSingletonResource

        public void addSingletonResource​(java.lang.Object singleton)
        Description copied from interface: Registry
        Add a JAX-RS endpoint.
        Specified by:
        addSingletonResource in interface Registry
      • 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 interface Registry
        basePath - prefix path of resource
      • addSingletonResource

        public void addSingletonResource​(java.lang.Object singleton,
                                         ResourceClass resourceClass,
                                         java.lang.String basePath)
        Specified by:
        addSingletonResource in interface Registry
      • 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 interface Registry
      • 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 interface Registry
        basePath - prefix path of resource
      • addJndiResource

        public void addJndiResource​(java.lang.String jndiName,
                                    ResourceClass resourceClass,
                                    java.lang.String basePath)
        Specified by:
        addJndiResource in interface Registry
      • 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 interface Registry
        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 interface Registry
        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 interface Registry
        Parameters:
        ref -
        base - base URI path for any resources provided by the factory, in addition to rootPath
        clazz - 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 interface Registry
        Parameters:
        ref -
        base - base URI path for any resources provided by the factory, in addition to rootPath
        classes - specific class
      • getDeclaredMethods

        private java.lang.reflect.Method[] getDeclaredMethods​(java.lang.Class<?> clazz)
      • 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 interface Registry
      • 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 interface Registry
        Parameters:
        clazz -
      • removeRegistrations

        public void removeRegistrations​(java.lang.Class clazz,
                                        java.lang.String base)
        Specified by:
        removeRegistrations in interface Registry
      • 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
        Specified by:
        getSize in interface Registry
        Returns: