org.glassfish.jersey.server.model
Class ResourceMethod

java.lang.Object
  extended by org.glassfish.jersey.server.model.ResourceMethod
All Implemented Interfaces:
Consuming, Producing, ResourceModelComponent, Routed, Suspendable

public class ResourceMethod
extends java.lang.Object
implements ResourceModelComponent, Routed, Producing, Consuming, Suspendable

Model of a method available on a resource. Covers resource method, sub-resource method and sub-resource locator.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class ResourceMethod.Builder
          Resource method model builder.
static class ResourceMethod.JaxrsType
          Resource method classification based on the recognized JAX-RS resource method types.
 
Method Summary
 void accept(ResourceModelVisitor visitor)
          A component should call the visitor back with an appropriate visitor interface method to give it a chance to process.
 java.util.List<? extends ResourceModelComponent> getComponents()
          Should return all existing resource model sub-components.
 java.util.List<MediaType> getConsumedTypes()
          Get the consumed media types supported by the component.
 java.lang.String getHttpMethod()
          Get the associated HTTP method.
 Invocable getInvocable()
          Get the invocable method model.
 java.lang.String getPath()
          Get the path direct assigned to the component.
 PathPattern getPathPattern()
          Get the path pattern that can be used for matching the remaining request URI against this component represented by this model.
 java.util.List<MediaType> getProducedTypes()
          Get the produced media types supported by the component.
 long getSuspendTimeout()
          Get the suspend timeout value in the given time unit.
 java.util.concurrent.TimeUnit getSuspendTimeoutUnit()
          Get the suspend timeout value time unit.
 ResourceMethod.JaxrsType getType()
          Get the JAX-RS method type.
 boolean isSuspendDeclared()
          Check if the component is marked for suspending.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getType

public ResourceMethod.JaxrsType getType()
Get the JAX-RS method type.

Returns:
the JAX-RS method type.

getHttpMethod

public java.lang.String getHttpMethod()
Get the associated HTTP method.

May return null in case the method represents a sub-resource locator.

Returns:
the associated HTTP method, or null in case this method represents a sub-resource locator.

getInvocable

public Invocable getInvocable()
Get the invocable method model.

Returns:
invocable method model.

getPath

public java.lang.String getPath()
Get the path direct assigned to the component.

In case of a resource method, an empty string is returned.

Specified by:
getPath in interface Routed
Returns:
the path directly assigned to the method or an empty string in case the method represents a resource method.

getPathPattern

public PathPattern getPathPattern()
Description copied from interface: Routed
Get the path pattern that can be used for matching the remaining request URI against this component represented by this model.

Specified by:
getPathPattern in interface Routed
Returns:
component path pattern.

getConsumedTypes

public java.util.List<MediaType> getConsumedTypes()
Description copied from interface: Consuming
Get the consumed media types supported by the component.

Specified by:
getConsumedTypes in interface Consuming
Returns:
immutable collection of supported consumed media types.

getProducedTypes

public java.util.List<MediaType> getProducedTypes()
Description copied from interface: Producing
Get the produced media types supported by the component.

Specified by:
getProducedTypes in interface Producing
Returns:
immutable collection of supported produced media types.

getSuspendTimeout

public long getSuspendTimeout()
Description copied from interface: Suspendable
Get the suspend timeout value in the given time unit.

Specified by:
getSuspendTimeout in interface Suspendable
Returns:
suspend timeout value.
See Also:
@Suspend.timeOut()

getSuspendTimeoutUnit

public java.util.concurrent.TimeUnit getSuspendTimeoutUnit()
Description copied from interface: Suspendable
Get the suspend timeout value time unit.

Specified by:
getSuspendTimeoutUnit in interface Suspendable
Returns:
time unit of the suspend timeout value.
See Also:
@Suspend.timeUnit()

isSuspendDeclared

public boolean isSuspendDeclared()
Description copied from interface: Suspendable
Check if the component is marked for suspending.

Specified by:
isSuspendDeclared in interface Suspendable
Returns:
true if the component is marked for suspending, false otherwise.

getComponents

public java.util.List<? extends ResourceModelComponent> getComponents()
Description copied from interface: ResourceModelComponent
Should return all existing resource model sub-components.

Specified by:
getComponents in interface ResourceModelComponent
Returns:
list of all sub-components

accept

public void accept(ResourceModelVisitor visitor)
Description copied from interface: ResourceModelComponent
A component should call the visitor back with an appropriate visitor interface method to give it a chance to process.

Specified by:
accept in interface ResourceModelComponent
Parameters:
visitor - resource model visitor.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.