org.atmosphere.jersey
Class TrackableResource<T extends Trackable>

java.lang.Object
  extended by org.atmosphere.jersey.TrackableResource<T>
Type Parameters:
T -

public class TrackableResource<T extends Trackable>
extends Object

Associate any kind of resource to a @Suspend operation. When returning a TrackableResource from a method annotated with the suspend annotation, the atmosphere framework will automatically add the X-Atmosphere-tracking-id header to the response. The header can later be used for injecting TrackableResource. As simple as


Constructor Summary
TrackableResource(Class<T> type, Object entity)
           
TrackableResource(Class<T> type, String trackingID, Object entity)
           
 
Method Summary
 Object entity()
          Return the Entity associated with the resource.
 T resource()
          Return the associated resource of type T
protected  void setResource(Trackable resource)
           
protected  void setTrackingID(String trackingID)
           
 String trackingID()
          Return the trackingID token associated with the resource.
 Class<T> type()
          Retunr the class's type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackableResource

public TrackableResource(Class<T> type,
                         Object entity)

TrackableResource

public TrackableResource(Class<T> type,
                         String trackingID,
                         Object entity)
Method Detail

setResource

protected void setResource(Trackable resource)

setTrackingID

protected void setTrackingID(String trackingID)

resource

public T resource()
Return the associated resource of type T

Returns:
the associated resource of type T

type

public Class<T> type()
Retunr the class's type.

Returns:

trackingID

public String trackingID()
Return the trackingID token associated with the resource.

Returns:
the trackingID token associated with the resource.

entity

public Object entity()
Return the Entity associated with the resource.

Returns:
the Entity associated with the resource.


Copyright © 2012. All Rights Reserved.