org.atmosphere.jersey
Class SuspendResponse<E>

java.lang.Object
  extended by com.sun.jersey.api.JResponse
      extended by 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
static class SuspendResponse.SuspendResponseBuilder<E>
          A Builder for SuspendResponse
static class SuspendResponse.TimeSpan
          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
protected SuspendResponse(SuspendResponse.SuspendResponseBuilder<E> b)
           
 
Method Summary
 Broadcaster broadcaster()
          Return the Broadcaster that will be used to broadcast events.
 Collection<AtmosphereResourceEventListener> listeners()
          Return the current list of AtmosphereResourceEventListener classes.
 boolean outputComments()
          Tell Atmosphere to write some comments during the connection suspension.
 SuspendResponse.TimeSpan period()
          Return the SuspendResponse.TimeSpan used to suspend the response.
 boolean resumeOnBroadcast()
          Resume the connection on the first Broadcaster.broadcast(Object) operations.
 Suspend.SCOPE scope()
          Return the Suspend.SCOPE value.
 boolean writeEntity()
          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 Detail

SuspendResponse

protected SuspendResponse(SuspendResponse.SuspendResponseBuilder<E> b)
Method Detail

scope

public 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 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<AtmosphereResourceEventListener> listeners()
Return the current list of AtmosphereResourceEventListener classes.

Returns:
the current list of AtmosphereResourceEventListener classes.


Copyright © 2014. All Rights Reserved.