Class SuspendResponse<E>

java.lang.Object
com.sun.jersey.api.JResponse
org.atmosphere.jersey.SuspendResponse<E>
Type Parameters:
E - the type

public class SuspendResponse<E> extends com.sun.jersey.api.JResponse
This class can be used to suspend response programmatically, similar to Suspend annotation.
         SuspendResponse<String> r = new SuspendResponse.SuspendResponseBuilder<String>()
              .broadcaster(broadcaster)
              .outputComments(true)
              .period(5, TimeUnit.SECONDS)
              .entity("foo")
              .build();
 
Author:
Jeanfrancois Arcand
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A Builder for SuspendResponse
    static class 
    Util class that encapsulate a period and a TimeUnit.

    Nested classes/interfaces inherited from class com.sun.jersey.api.JResponse

    com.sun.jersey.api.JResponse.AJResponseBuilder<E,B extends com.sun.jersey.api.JResponse.AJResponseBuilder>, com.sun.jersey.api.JResponse.JResponseBuilder<E>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.atmosphere.cpr.Broadcaster
    Return the Broadcaster that will be used to broadcast events.
    Collection<org.atmosphere.cpr.AtmosphereResourceEventListener>
    Return the current list of AtmosphereResourceEventListener classes.
    boolean
    Tell Atmosphere to write some comments during the connection suspension.
    Return the SuspendResponse.TimeSpan used to suspend the response.
    boolean
    Resume the connection on the first Broadcaster.broadcast(Object) operations.
    org.atmosphere.annotation.Suspend.SCOPE
    Return the Suspend.SCOPE value.
    boolean
    Write the returned entity back to the calling connection.

    Methods inherited from class com.sun.jersey.api.JResponse

    created, fromResponse, fromResponse, getEntity, getMetadata, getStatus, getStatusType, getType, noContent, notAcceptable, notModified, notModified, notModified, ok, ok, ok, ok, ok, seeOther, serverError, status, status, status, temporaryRedirect, toResponse, toResponse

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • scope

      public org.atmosphere.annotation.Suspend.SCOPE scope()
      Return the Suspend.SCOPE value.
      Returns:
      the Suspend.SCOPE value.
    • period

      public SuspendResponse.TimeSpan period()
      Return the SuspendResponse.TimeSpan used to suspend the response.
      Returns:
      the SuspendResponse.TimeSpan used to suspend the response.
    • outputComments

      public boolean outputComments()
      Tell Atmosphere to write some comments during the connection suspension.
      Returns:
      true is comment will be written.
    • resumeOnBroadcast

      public boolean resumeOnBroadcast()
      Resume the connection on the first Broadcaster.broadcast(Object) operations.
      Returns:
      true if the connection needs to be resumed.
    • writeEntity

      public boolean writeEntity()
      Write the returned entity back to the calling connection. Default is false.
    • broadcaster

      public org.atmosphere.cpr.Broadcaster broadcaster()
      Return the Broadcaster that will be used to broadcast events.
      Returns:
      the Broadcaster that will be used to broadcast events.
    • listeners

      public Collection<org.atmosphere.cpr.AtmosphereResourceEventListener> listeners()
      Return the current list of AtmosphereResourceEventListener classes.
      Returns:
      the current list of AtmosphereResourceEventListener classes.