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 java.lang.Object
implements ResourceInvoker, InterceptorRegistryListener

Version:
$Revision: 1 $
Author:
Bill Burke

Field Summary
protected  MediaType[] consumes
           
protected  java.lang.reflect.Type genericReturnType
           
protected  java.util.Set<java.lang.String> httpMethods
           
protected  InjectorFactory injector
           
protected  java.lang.reflect.Method method
           
protected  MethodInjector methodInjector
           
protected  PostProcessInterceptor[] postProcessInterceptors
           
protected  java.util.List<WeightedMediaType> preferredConsumes
           
protected  java.util.List<WeightedMediaType> preferredProduces
           
protected  PreProcessInterceptor[] preProcessInterceptors
           
protected  MediaType[] produces
           
protected  ResteasyProviderFactory providerFactory
           
protected  ResourceFactory resource
           
protected  java.lang.Class<?> resourceClass
           
protected  java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.atomic.AtomicLong> stats
           
protected  MessageBodyWriterInterceptor[] writerInterceptors
           
 
Constructor Summary
ResourceMethod(java.lang.Class<?> clazz, java.lang.reflect.Method method, InjectorFactory injector, ResourceFactory resource, ResteasyProviderFactory providerFactory, java.util.Set<java.lang.String> httpMethods)
           
 
Method Summary
 void cleanup()
           
 boolean doesConsume(MediaType contentType)
           
 boolean doesProduce(java.util.List<? extends MediaType> accepts)
           
 MediaType[] getConsumes()
           
 java.util.Set<java.lang.String> getHttpMethods()
           
 java.lang.reflect.Method getMethod()
           
 java.util.List<WeightedMediaType> getPreferredConsumes()
          Presorted list of preferred types, 1st entry is most preferred
 java.util.List<WeightedMediaType> getPreferredProduces()
          Presorted list of preferred types, 1st entry is most preferred
 MediaType[] getProduces()
           
 java.lang.Class<?> getResourceClass()
           
 java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> getStats()
          Key is httpMethod called
protected  void incrementMethodCount(java.lang.String httpMethod)
           
 ServerResponse invoke(HttpRequest request, HttpResponse response)
           
 ServerResponse invoke(HttpRequest request, HttpResponse response, java.lang.Object target)
           
protected  ServerResponse invokeOnTarget(HttpRequest request, HttpResponse response, java.lang.Object target)
           
 MediaType matchByType(java.util.List<MediaType> accepts, java.lang.Object entity)
           
protected  ServerResponse prepareResponse(ServerResponse serverResponse)
           
 void registryUpdated(InterceptorRegistry registry)
           
protected  MediaType resolveContentType(HttpRequest in, java.lang.Object entity)
           
protected  MediaType resolveContentTypeByAccept(java.util.List<MediaType> accepts, java.lang.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

preferredProduces

protected java.util.List<WeightedMediaType> preferredProduces

preferredConsumes

protected java.util.List<WeightedMediaType> preferredConsumes

httpMethods

protected java.util.Set<java.lang.String> httpMethods

methodInjector

protected MethodInjector methodInjector

injector

protected InjectorFactory injector

resource

protected ResourceFactory resource

providerFactory

protected ResteasyProviderFactory providerFactory

method

protected java.lang.reflect.Method method

resourceClass

protected java.lang.Class<?> resourceClass

preProcessInterceptors

protected PreProcessInterceptor[] preProcessInterceptors

postProcessInterceptors

protected PostProcessInterceptor[] postProcessInterceptors

writerInterceptors

protected MessageBodyWriterInterceptor[] writerInterceptors

stats

protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.atomic.AtomicLong> stats

genericReturnType

protected java.lang.reflect.Type genericReturnType
Constructor Detail

ResourceMethod

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

cleanup

public void cleanup()

registryUpdated

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

incrementMethodCount

protected void incrementMethodCount(java.lang.String httpMethod)

getStats

public java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> getStats()
Key is httpMethod called

Returns:

getResourceClass

public java.lang.Class<?> getResourceClass()

getPreferredProduces

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

Returns:

getPreferredConsumes

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

Returns:

getMethod

public java.lang.reflect.Method getMethod()

invoke

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

invoke

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

invokeOnTarget

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

prepareResponse

protected ServerResponse prepareResponse(ServerResponse serverResponse)

doesProduce

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

doesConsume

public boolean doesConsume(MediaType contentType)

resolveContentType

protected MediaType resolveContentType(HttpRequest in,
                                       java.lang.Object entity)

matchByType

public MediaType matchByType(java.util.List<MediaType> accepts,
                             java.lang.Object entity)

resolveContentTypeByAccept

protected MediaType resolveContentTypeByAccept(java.util.List<MediaType> accepts,
                                               java.lang.Object entity)

getHttpMethods

public java.util.Set<java.lang.String> getHttpMethods()

getProduces

public MediaType[] getProduces()

getConsumes

public MediaType[] getConsumes()


Copyright © 2010. All Rights Reserved.