Class ResourceMethod
- java.lang.Object
-
- org.restlet.ext.jaxrs.internal.wrappers.AbstractJaxRsWrapper
-
- org.restlet.ext.jaxrs.internal.wrappers.AbstractMethodWrapper
-
- org.restlet.ext.jaxrs.internal.wrappers.ResourceMethod
-
- All Implemented Interfaces:
ResourceMethodOrLocator,RrcOrRml
@Deprecated public class ResourceMethod extends AbstractMethodWrapper implements ResourceMethodOrLocator
Deprecated.Will be removed in next minor release.This class wraps JAX-RS resource methods and sub resource methods.
It does not wrap sub resource locators; seeSubResourceLocator
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.MethodannotatedMethodDeprecated.the Java method that should be referenced for annotations.private java.util.List<MediaType>consumedMimesDeprecated.private MethodhttpMethodDeprecated.private java.util.List<MediaType>producedMimesDeprecated.private java.util.Collection<javax.ws.rs.core.Variant>supportedVariantsDeprecated.Contains the list of supportedVariants (lazy initialized bygetSupportedVariants().-
Fields inherited from class org.restlet.ext.jaxrs.internal.wrappers.AbstractMethodWrapper
executeMethod, parameters, resourceClass
-
-
Constructor Summary
Constructors Constructor Description ResourceMethod(java.lang.reflect.Method executeMethod, java.lang.reflect.Method annotatedMethod, ResourceClass resourceClass, Method httpMethod, ThreadLocalizedContext tlContext, JaxRsProviders jaxRsProviders, ExtensionBackwardMapping extensionBackwardMapping, java.util.logging.Logger logger)Deprecated.Creates a wrapper for a resource method.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private java.util.List<MediaType>createConsumedMimes()Deprecated.Creates the list of the consumed mimes from theAbstractMethodWrapper#annotatedMethodand theAbstractMethodWrapper.executeMethodto be stored in the final instance variableconsumedMimes.private java.util.List<MediaType>createProducedMimes()Deprecated.Creates the list of the produced mimes from theAbstractMethodWrapper#annotatedMethodand theAbstractMethodWrapper.executeMethodto be stored in the final instance variableproducedMimes.private java.util.Collection<javax.ws.rs.core.Variant>createSupportedVariants()Deprecated.Creates the list of the supported variants from thegetProducedMimes()to be stored in the final instance variablesupportedVariants.java.lang.annotation.Annotation[]getAnnotations()Deprecated.Returns the array of the annotations on the Java methodjava.util.List<MediaType>getConsumedMimes()Deprecated.java.lang.reflect.TypegetGenericReturnType()Deprecated.Returns the generic return type of the wrapped method.MethodgetHttpMethod()Deprecated.java.util.List<MediaType>getProducedMimes()Deprecated.java.util.Collection<javax.ws.rs.core.Variant>getSupportedVariants()Deprecated.Returns theVariants supported by this resource method.java.lang.Objectinvoke(ResourceObject resourceObject)Deprecated.Invokes the method and returned the created representation for the response.booleanisAcceptedMediaTypeSupported(SortedMetadata<MediaType> accMediaTypess)Deprecated.Check if this method supports the media type to produce for a request.booleanisGivenMediaTypeSupported(MediaType givenMediaType)Deprecated.booleanisHttpMethodSupported(Method requestedMethod)Deprecated.booleanisHttpMethodSupported(Method requestedMethod, boolean alsoGet)Deprecated.Checks, if this method suppors the given HTTP method.java.lang.StringtoString()Deprecated.-
Methods inherited from class org.restlet.ext.jaxrs.internal.wrappers.AbstractMethodWrapper
getName, getPathRegExp, getResourceClass, internalInvoke
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.restlet.ext.jaxrs.internal.wrappers.ResourceMethodOrLocator
getName, getPathRegExp, getResourceClass
-
-
-
-
Field Detail
-
annotatedMethod
private final java.lang.reflect.Method annotatedMethod
Deprecated.the Java method that should be referenced for annotations. This method could be different from the method is called for executing, see section 3.6 "Annotation Inheritance" of JSR-311-spec.- See Also:
AbstractMethodWrapper.executeMethod
-
consumedMimes
private final java.util.List<MediaType> consumedMimes
Deprecated.- See Also:
Consumes
-
httpMethod
private final Method httpMethod
Deprecated.
-
producedMimes
private final java.util.List<MediaType> producedMimes
Deprecated.- See Also:
Produces
-
supportedVariants
private final java.util.Collection<javax.ws.rs.core.Variant> supportedVariants
Deprecated.Contains the list of supportedVariants (lazy initialized bygetSupportedVariants().
-
-
Constructor Detail
-
ResourceMethod
ResourceMethod(java.lang.reflect.Method executeMethod, java.lang.reflect.Method annotatedMethod, ResourceClass resourceClass, Method httpMethod, ThreadLocalizedContext tlContext, JaxRsProviders jaxRsProviders, ExtensionBackwardMapping extensionBackwardMapping, java.util.logging.Logger logger) throws IllegalPathOnMethodException, java.lang.IllegalArgumentException, MissingAnnotationException, IllegalMethodParamTypeException, IllegalPathParamTypeExceptionDeprecated.Creates a wrapper for a resource method.- Parameters:
executeMethod- the Java method to wrap.annotatedMethod- the java method that contains the annotations for this method.resourceClass- the wrapped class of the method.httpMethod- the HTTP method of the Java method. It will be checked be theJaxRsRestlet, so avoiding double work. It will be requested from the javaMethod.tlContext- theThreadLocalizedContextof theJaxRsRestlet.jaxRsProviders- all entity providersextensionBackwardMapping- the extension backward mappinglogger-- Throws:
IllegalPathOnMethodExceptionMissingAnnotationExceptionjava.lang.IllegalArgumentException- if the annotated method is nullIllegalMethodParamTypeException- if one of the method parameters annotated with @Contexthas a type that must not be annotated with @Context.IllegalPathParamTypeException
-
-
Method Detail
-
createConsumedMimes
private java.util.List<MediaType> createConsumedMimes()
Deprecated.Creates the list of the consumed mimes from theAbstractMethodWrapper#annotatedMethodand theAbstractMethodWrapper.executeMethodto be stored in the final instance variableconsumedMimes.
-
createProducedMimes
private java.util.List<MediaType> createProducedMimes()
Deprecated.Creates the list of the produced mimes from theAbstractMethodWrapper#annotatedMethodand theAbstractMethodWrapper.executeMethodto be stored in the final instance variableproducedMimes.
-
createSupportedVariants
private java.util.Collection<javax.ws.rs.core.Variant> createSupportedVariants()
Deprecated.Creates the list of the supported variants from thegetProducedMimes()to be stored in the final instance variablesupportedVariants.
-
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
Deprecated.Returns the array of the annotations on the Java method- Returns:
- the array of the annotations on the Java method
- See Also:
AccessibleObject.getAnnotations()
-
getConsumedMimes
public java.util.List<MediaType> getConsumedMimes()
Deprecated.- Returns:
- Returns an unmodifiable List with the MediaTypes the given resourceMethod consumes. If no consumeMime is given, this method returns a List with MediaType.ALL. Will never return null.
-
getGenericReturnType
public java.lang.reflect.Type getGenericReturnType()
Deprecated.Returns the generic return type of the wrapped method.- Returns:
- the generic return type of the wrapped method.
- See Also:
Method.getGenericReturnType()
-
getHttpMethod
public Method getHttpMethod()
Deprecated.- Returns:
- Returns the HTTP method supported by the wrapped java method.
-
getProducedMimes
public java.util.List<MediaType> getProducedMimes()
Deprecated.- Returns:
- Returns an unmodifiable List of MediaTypes the given Resource
Method. if the method is not annotated with
Produces, than theProducesof the Resource class is returned. If noProducescan be found, an empty (also unmodifiable) List will returned.
This method never returns null.
-
getSupportedVariants
public java.util.Collection<javax.ws.rs.core.Variant> getSupportedVariants()
Deprecated.Returns theVariants supported by this resource method.- Returns:
- the
Variants supported by this resource method.
-
invoke
public java.lang.Object invoke(ResourceObject resourceObject) throws MethodInvokeException, java.lang.reflect.InvocationTargetException, ConvertRepresentationException, javax.ws.rs.WebApplicationException
Deprecated.Invokes the method and returned the created representation for the response.- Parameters:
resourceObject-- Returns:
- the unwrapped returned object by the wrapped method.
- Throws:
MethodInvokeExceptionjava.lang.reflect.InvocationTargetExceptionNoMessageBodyReaderExceptionMissingAnnotationExceptionConvertCookieParamExceptionConvertQueryParamExceptionConvertMatrixParamExceptionConvertPathParamExceptionConvertHeaderParamExceptionConvertRepresentationExceptionjavax.ws.rs.WebApplicationException
-
isAcceptedMediaTypeSupported
public boolean isAcceptedMediaTypeSupported(SortedMetadata<MediaType> accMediaTypess)
Deprecated.Check if this method supports the media type to produce for a request.- Parameters:
accMediaTypess- The Media Types the client would accept, ordered by quality. SeeSortedMetadata- Returns:
- Returns true, if the give MediaType is supported by the method, or no MediaType is given for the method, otherweise false.
-
isGivenMediaTypeSupported
public boolean isGivenMediaTypeSupported(MediaType givenMediaType)
Deprecated.- Parameters:
resourceMethod- the resource method to checkgivenMediaType- the MediaType of the request entity- Returns:
- Returns true, if the given MediaType is supported by the method, or no MediaType is given for the method, otherweise false;
-
isHttpMethodSupported
public boolean isHttpMethodSupported(Method requestedMethod)
Deprecated.- Parameters:
resourceMethod-requestedMethod-- Returns:
- true, if the gien java method is annotated with a runtime designator for the given requested Method. If the requested method is null, than the method returns true, when the method is annotated with any runtime desginator.
- See Also:
#annotatedWithMethodDesignator(Method)
-
isHttpMethodSupported
public boolean isHttpMethodSupported(Method requestedMethod, boolean alsoGet) throws java.lang.IllegalArgumentException
Deprecated.Checks, if this method suppors the given HTTP method.- Parameters:
requestedMethod- the requested MethodalsoGet- if true, than this method returns also true, if this method is GET. This functionality is needed for HEAD.- Returns:
- true, if this method supports the given HTTP method. Returns also true, if alsoGet is true and this method is true.
- Throws:
java.lang.IllegalArgumentException
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classAbstractMethodWrapper
-
-