org.jboss.resteasy.core
Class ResourceMethodRegistry

java.lang.Object
  extended by org.jboss.resteasy.core.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 $
Author:
Bill Burke

Field Summary
protected  ResteasyProviderFactory providerFactory
           
protected  RootSegment rootSegment
           
protected  int size
           
 
Constructor Summary
ResourceMethodRegistry(ResteasyProviderFactory providerFactory)
           
 
Method Summary
 void addJndiResource(java.lang.String jndiName)
          Add a JAX-RS endpoint that exists in JNDI
 void addJndiResource(java.lang.String jndiName, java.lang.String basePath)
          Add a JAX-RS endpoint that exists in JNDI.
 void addPerRequestResource(java.lang.Class clazz)
          Register a vanilla JAX-RS resource class
 void addPerRequestResource(java.lang.Class clazz, java.lang.String basePath)
          Add a JAX-RS endpoint.
 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 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.
 ResourceInvoker getResourceInvoker(HttpRequest request, HttpResponse response)
          Find a resource to invoke on
 RootSegment getRoot()
           
 int getSize()
          Number of endpoints registered
protected  void processMethod(ResourceFactory ref, java.lang.String base, java.lang.Class<?> clazz, java.lang.reflect.Method method)
           
 void removeRegistrations(java.lang.Class clazz)
          Find all endpoints reachable by clazz and unregister them
 void removeRegistrations(java.lang.Class clazz, java.lang.String base)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size

providerFactory

protected ResteasyProviderFactory providerFactory

rootSegment

protected RootSegment rootSegment
Constructor Detail

ResourceMethodRegistry

public ResourceMethodRegistry(ResteasyProviderFactory providerFactory)
Method Detail

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

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

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

addPerRequestResource

public void addPerRequestResource(java.lang.Class clazz)
Register a vanilla JAX-RS resource class

Specified by:
addPerRequestResource in interface Registry
Parameters:
clazz -

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:
factory -

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:
factory -
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:
factory -
base - base URI path for any resources provided by the factory, in addition to rootPath
clazz - specific class
offset - path segment offset. > 0 means we're within a locator.

processMethod

protected void processMethod(ResourceFactory ref,
                             java.lang.String base,
                             java.lang.Class<?> clazz,
                             java.lang.reflect.Method method)

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

getRoot

public RootSegment getRoot()

getSize

public int getSize()
Number of endpoints registered

Specified by:
getSize in interface Registry
Returns:

getResourceInvoker

public ResourceInvoker getResourceInvoker(HttpRequest request,
                                          HttpResponse response)
Find a resource to invoke on

Specified by:
getResourceInvoker in interface Registry
Parameters:
httpMethod - GET, POST, PUT, OPTIONS, TRACE, etc...
path - uri path
contentType - produced type
accepts - accept header
Returns:


Copyright © 2009. All Rights Reserved.