org.jboss.resteasy.core
Class ResourceMethod

java.lang.Object
  extended by org.jboss.resteasy.core.ResourceMethod
All Implemented Interfaces:
InterceptorRegistryListener, ResourceInvoker

public class ResourceMethod
extends Object
implements ResourceInvoker, InterceptorRegistryListener

Version:
$Revision: 1 $
Author:
Bill Burke

Field Summary
protected  MediaType[] consumes
           
protected  Type genericReturnType
           
protected  Set<String> httpMethods
           
protected  InjectorFactory injector
           
protected  Method method
           
protected  Consumes methodConsumes
           
protected  MethodInjector methodInjector
           
protected  PostProcessInterceptor[] postProcessInterceptors
           
protected  List<WeightedMediaType> preferredConsumes
           
protected  List<WeightedMediaType> preferredProduces
           
protected  PreProcessInterceptor[] preProcessInterceptors
           
protected  MediaType[] produces
           
protected  ResteasyProviderFactory providerFactory
           
protected  ResourceFactory resource
           
protected  Class<?> resourceClass
           
protected  ConcurrentHashMap<String,AtomicLong> stats
           
protected  MessageBodyWriterInterceptor[] writerInterceptors
           
 
Constructor Summary
ResourceMethod(Class<?> clazz, Method method, InjectorFactory injector, ResourceFactory resource, ResteasyProviderFactory providerFactory, Set<String> httpMethods)
           
 
Method Summary
 void cleanup()
           
 boolean doesConsume(MediaType contentType)
           
 boolean doesProduce(List<? extends MediaType> accepts)
           
 MediaType[] getConsumes()
           
 Set<String> getHttpMethods()
           
 Method getMethod()
           
 List<WeightedMediaType> getPreferredConsumes()
          Presorted list of preferred types, 1st entry is most preferred
 List<WeightedMediaType> getPreferredProduces()
          Presorted list of preferred types, 1st entry is most preferred
 MediaType[] getProduces()
           
 Class<?> getResourceClass()
           
 Map<String,AtomicLong> getStats()
          Key is httpMethod called
protected  void incrementMethodCount(String httpMethod)
           
 ServerResponse invoke(HttpRequest request, HttpResponse response)
           
 ServerResponse invoke(HttpRequest request, HttpResponse response, Object target)
           
protected  ServerResponse invokeOnTarget(HttpRequest request, HttpResponse response, Object target)
           
protected  ServerResponse prepareResponse(ServerResponse serverResponse)
           
 void registryUpdated(InterceptorRegistry registry)
           
 MediaType resolveContentType(HttpRequest in, Object entity)
           
protected  MediaType resolveContentTypeByAccept(List<MediaType> accepts, Object entity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

produces

protected MediaType[] produces

consumes

protected MediaType[] consumes

methodConsumes

protected Consumes methodConsumes

preferredProduces

protected List<WeightedMediaType> preferredProduces

preferredConsumes

protected List<WeightedMediaType> preferredConsumes

httpMethods

protected Set<String> httpMethods

methodInjector

protected MethodInjector methodInjector

injector

protected InjectorFactory injector

resource

protected ResourceFactory resource

providerFactory

protected ResteasyProviderFactory providerFactory

method

protected Method method

resourceClass

protected Class<?> resourceClass

preProcessInterceptors

protected PreProcessInterceptor[] preProcessInterceptors

postProcessInterceptors

protected PostProcessInterceptor[] postProcessInterceptors

writerInterceptors

protected MessageBodyWriterInterceptor[] writerInterceptors

stats

protected ConcurrentHashMap<String,AtomicLong> stats

genericReturnType

protected Type genericReturnType
Constructor Detail

ResourceMethod

public ResourceMethod(Class<?> clazz,
                      Method method,
                      InjectorFactory injector,
                      ResourceFactory resource,
                      ResteasyProviderFactory providerFactory,
                      Set<String> httpMethods)
Method Detail

cleanup

public void cleanup()

registryUpdated

public void registryUpdated(InterceptorRegistry registry)
Specified by:
registryUpdated in interface InterceptorRegistryListener

incrementMethodCount

protected void incrementMethodCount(String httpMethod)

getStats

public Map<String,AtomicLong> getStats()
Key is httpMethod called

Returns:

getResourceClass

public Class<?> getResourceClass()

getPreferredProduces

public List<WeightedMediaType> getPreferredProduces()
Presorted list of preferred types, 1st entry is most preferred

Returns:

getPreferredConsumes

public List<WeightedMediaType> getPreferredConsumes()
Presorted list of preferred types, 1st entry is most preferred

Returns:

getMethod

public Method getMethod()

invoke

public ServerResponse invoke(HttpRequest request,
                             HttpResponse response)
Specified by:
invoke in interface ResourceInvoker

invoke

public ServerResponse invoke(HttpRequest request,
                             HttpResponse response,
                             Object target)
Specified by:
invoke in interface ResourceInvoker

invokeOnTarget

protected ServerResponse invokeOnTarget(HttpRequest request,
                                        HttpResponse response,
                                        Object target)

prepareResponse

protected ServerResponse prepareResponse(ServerResponse serverResponse)

doesProduce

public boolean doesProduce(List<? extends MediaType> accepts)

doesConsume

public boolean doesConsume(MediaType contentType)

resolveContentType

public MediaType resolveContentType(HttpRequest in,
                                    Object entity)

resolveContentTypeByAccept

protected MediaType resolveContentTypeByAccept(List<MediaType> accepts,
                                               Object entity)

getHttpMethods

public Set<String> getHttpMethods()

getProduces

public MediaType[] getProduces()

getConsumes

public MediaType[] getConsumes()


Copyright © 2011. All Rights Reserved.