Package org.jboss.resteasy.plugins.server.resourcefactory

## Class JndiComponentResourceFactory

- java.lang.Object
- - org.jboss.resteasy.plugins.server.resourcefactory.JndiComponentResourceFactory

- All Implemented Interfaces:
    `ResourceFactory`

      public class JndiComponentResourceFactory
      extends Object
      implements ResourceFactory

  Used for component jndi-based resources like EJBs.
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JndiComponentResourceFactory​(String jndiName, Class<?> scannable, boolean cacheReference)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Object` | `createResource​(HttpRequest request, HttpResponse response, ResteasyProviderFactory factory)` | Called per request to obtain a resource instance to invoke http request on.
    `Class<?>` | `getScannableClass()` | Class to scan for jax-rs annotations
    `void` | `registered​(ResteasyProviderFactory factory)` | Callback after registration has been completed.
    `void` | `requestFinished​(HttpRequest request, HttpResponse response, Object resource)` | Callback when request is finished.
    `void` | `unregistered()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JndiComponentResourceFactory

          public JndiComponentResourceFactory​(String jndiName,
                                              Class<?> scannable,
                                              boolean cacheReference)

  - ### Method Detail

    - #### registered

          public void registered​(ResteasyProviderFactory factory)

      Description copied from interface: `ResourceFactory`
      Callback after registration has been completed.
      Specified by:
        `registered` in interface `ResourceFactory`
      Parameters:
        `factory` - allows singleton factories to pre-inject things like @Context references into the singleton instance

    - #### createResource

          public Object createResource​(HttpRequest request,
                                       HttpResponse response,
                                       ResteasyProviderFactory factory)

      Description copied from interface: `ResourceFactory`
      Called per request to obtain a resource instance to invoke http request on.
      Specified by:
        `createResource` in interface `ResourceFactory`
      Parameters:
        `request` - http request
        `response` - http response
        `factory` - provider factory
      Returns:
        resource object or a CompletionStage

    - #### unregistered

          public void unregistered()

      Specified by:
        `unregistered` in interface `ResourceFactory`

    - #### getScannableClass

          public Class<?> getScannableClass()

      Description copied from interface: `ResourceFactory`
      Class to scan for jax-rs annotations
      Specified by:
        `getScannableClass` in interface `ResourceFactory`
      Returns:
        class

    - #### requestFinished

          public void requestFinished​(HttpRequest request,
                                      HttpResponse response,
                                      Object resource)

      Description copied from interface: `ResourceFactory`
      Callback when request is finished. usable for things like @PreDestroy if the underlying factory supports it
      Specified by:
        `requestFinished` in interface `ResourceFactory`
      Parameters:
        `request` - http request
        `response` - http response
        `resource` - resource