org.glassfish.jersey.server.model
Class AbstractResourceMethod

java.lang.Object
  extended by org.glassfish.jersey.server.model.AbstractResourceMethod
All Implemented Interfaces:
ConsumesProducesEnabledComponent, ResourceModelComponent, SuspendableComponent
Direct Known Subclasses:
AbstractSubResourceMethod, InflectorBasedResourceMethod, ResourceMethod

public abstract class AbstractResourceMethod
extends Object
implements ResourceModelComponent, ConsumesProducesEnabledComponent, SuspendableComponent

Abstraction for a resource method defined by a HTTP method and consumed/produced media type list.

Author:
Jakub Podlesak (jakub.podlesak at oracle.com)
See Also:
ResourceClass

Constructor Summary
AbstractResourceMethod(ResourceClass resource, String httpMethod)
          Constructs a new resource method associated with given resource.
 
Method Summary
 boolean areInputTypesDeclared()
          Provides information on whether consumed media types were explicitly configured for this component.
 boolean areOutputTypesDeclared()
          Provides information on whether produced media types were explicitly configured for this component.
 void declareSuspend(long timeout, TimeUnit unit)
          Mark the component for suspending.
 List<ResourceModelComponent> getComponents()
          Should return all existing resource model sub-components.
 ResourceClass getDeclaringResource()
          Enclosing resource class getter.
 String getHttpMethod()
           
 List<javax.ws.rs.core.MediaType> getSupportedInputTypes()
          Getter for consumed media types.
 List<javax.ws.rs.core.MediaType> getSupportedOutputTypes()
          Getter for produced media types.
 long getSuspendTimeout()
          Get the suspend timeout value in the given time unit.
 TimeUnit getSuspendTimeoutUnit()
          Get the suspend timeout value time unit.
 boolean isSuspendDeclared()
          Check if the component is marked for suspending.
 void setAreInputTypesDeclared(boolean declared)
          Setter for information on how the consumed media types were configured.
 void setAreOutputTypesDeclared(boolean declared)
          Setter for information on how the produced media types were configured.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.glassfish.jersey.server.model.ResourceModelComponent
accept
 

Constructor Detail

AbstractResourceMethod

public AbstractResourceMethod(ResourceClass resource,
                              String httpMethod)
Constructs a new resource method associated with given resource. You need to add the new instance to the list of resource methods manually.

Parameters:
resource - resource class where the new resource method should belong to
httpMethod - corresponding HTTP method (e.g. "GET", "PUT", etc.)
Method Detail

getDeclaringResource

public ResourceClass getDeclaringResource()
Enclosing resource class getter.

Returns:
Corresponding resource class

getSupportedInputTypes

public List<javax.ws.rs.core.MediaType> getSupportedInputTypes()
Getter for consumed media types.

Specified by:
getSupportedInputTypes in interface ConsumesProducesEnabledComponent
Returns:
list of consumed media types
See Also:
areInputTypesDeclared()

setAreInputTypesDeclared

public void setAreInputTypesDeclared(boolean declared)
Description copied from interface: ConsumesProducesEnabledComponent
Setter for information on how the consumed media types were configured.

Specified by:
setAreInputTypesDeclared in interface ConsumesProducesEnabledComponent
Parameters:
declared -

areInputTypesDeclared

public boolean areInputTypesDeclared()
Description copied from interface: ConsumesProducesEnabledComponent
Provides information on whether consumed media types were explicitly configured for this component.

Specified by:
areInputTypesDeclared in interface ConsumesProducesEnabledComponent
Returns:
true if consumed media types were configured explicitly

getSupportedOutputTypes

public List<javax.ws.rs.core.MediaType> getSupportedOutputTypes()
Description copied from interface: ConsumesProducesEnabledComponent
Getter for produced media types. Returned list could be mutable if given component supports updating.

Specified by:
getSupportedOutputTypes in interface ConsumesProducesEnabledComponent
Returns:
list of produced media types
See Also:
ConsumesProducesEnabledComponent.areOutputTypesDeclared()

setAreOutputTypesDeclared

public void setAreOutputTypesDeclared(boolean declared)
Description copied from interface: ConsumesProducesEnabledComponent
Setter for information on how the produced media types were configured.

Specified by:
setAreOutputTypesDeclared in interface ConsumesProducesEnabledComponent
Parameters:
declared - should be set to true if produced media types were configured explicitly.

areOutputTypesDeclared

public boolean areOutputTypesDeclared()
Description copied from interface: ConsumesProducesEnabledComponent
Provides information on whether produced media types were explicitly configured for this component.

Specified by:
areOutputTypesDeclared in interface ConsumesProducesEnabledComponent
Returns:
true if produced media types were configured explicitly

getSuspendTimeout

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

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

getSuspendTimeoutUnit

public TimeUnit getSuspendTimeoutUnit()
Description copied from interface: SuspendableComponent
Get the suspend timeout value time unit.

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

isSuspendDeclared

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

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

declareSuspend

public void declareSuspend(long timeout,
                           TimeUnit unit)
Description copied from interface: SuspendableComponent
Mark the component for suspending. An invocation of a component (resource or sub-resource method) marked for suspending will be automatically suspended.

Specified by:
declareSuspend in interface SuspendableComponent
Parameters:
timeout - suspend timeout value.
unit - suspend timeout time unit.

getHttpMethod

public String getHttpMethod()

getComponents

public List<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

toString

public String toString()
Overrides:
toString in class Object


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