public class AtmosphereResourceImpl extends Object implements AtmosphereResource
AtmosphereResource.TRANSPORT| Modifier and Type | Field and Description |
|---|---|
protected AsyncSupport |
asyncSupport |
protected Broadcaster |
broadcaster |
protected List<Broadcaster> |
broadcasters |
static String |
METEOR |
static String |
PRE_SUSPEND |
protected javax.servlet.http.HttpSession |
session |
static String |
SKIP_BROADCASTER_CREATION |
| Constructor and Description |
|---|
AtmosphereResourceImpl() |
AtmosphereResourceImpl(AtmosphereConfig config,
Broadcaster broadcaster,
AtmosphereRequest req,
AtmosphereResponse response,
AsyncSupport asyncSupport,
AtmosphereHandler atmosphereHandler)
Deprecated.
|
public static final String PRE_SUSPEND
public static final String SKIP_BROADCASTER_CREATION
public static final String METEOR
protected final List<Broadcaster> broadcasters
protected Broadcaster broadcaster
protected AsyncSupport asyncSupport
protected javax.servlet.http.HttpSession session
public AtmosphereResourceImpl()
@Deprecated public AtmosphereResourceImpl(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest req, AtmosphereResponse response, AsyncSupport asyncSupport, AtmosphereHandler atmosphereHandler)
public AtmosphereResource initialize(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest req, AtmosphereResponse response, AsyncSupport asyncSupport, AtmosphereHandler atmosphereHandler)
AtmosphereResource.initialize in interface AtmosphereResourceconfig - The AtmosphereConfigbroadcaster - The Broadcaster.req - The AtmosphereRequestresponse - The AtmosphereResourceasyncSupport - The AsyncSupportatmosphereHandler - The AtmosphereHandlerprotected void register()
public AtmosphereResourceEventImpl getAtmosphereResourceEvent()
AtmosphereResourceAtmosphereResourceEvent.getAtmosphereResourceEvent in interface AtmosphereResourcepublic AtmosphereHandler getAtmosphereHandler()
AtmosphereResourceAtmosphereHandler associated with this resource.getAtmosphereHandler in interface AtmosphereResourceAtmosphereHandler associated with this resourcepublic AtmosphereResource writeOnTimeout(Object o)
AtmosphereResourcewriteOnTimeout in interface AtmosphereResourcepublic Object writeOnTimeout()
AtmosphereResourcewriteOnTimeout in interface AtmosphereResourcepublic String uuid()
AtmosphereResourceuuid in interface AtmosphereResourcepublic AtmosphereResource.TRANSPORT transport()
AtmosphereResourceAtmosphereResource.TRANSPORT. The transport value is retrieved using the HeaderConfig.X_ATMOSPHERE_TRANSPORT
header value.transport in interface AtmosphereResourcepublic AtmosphereResourceImpl transport(AtmosphereResource.TRANSPORT transport)
TRANSPORTtransport - set the TRANSPORTpublic AtmosphereResource resumeOnBroadcast(boolean resumeOnBroadcast)
AtmosphereResourceresumeOnBroadcast in interface AtmosphereResourcepublic boolean isSuspended()
AtmosphereResourceAtmosphereResource.suspend() has been invoked.isSuspended in interface AtmosphereResourceAtmosphereResource.suspend() has been invokedpublic boolean resumeOnBroadcast()
AtmosphereResourceresumeOnBroadcast in interface AtmosphereResourceAtmosphereResource.resumeOnBroadcast()public AtmosphereResource resume()
AtmosphereResourceAtmosphereResponse and finish/commit it. If the AtmosphereResponse is in the
process of being resumed, invoking this method has no effect.resume in interface AtmosphereResourcepublic AtmosphereResource suspend()
AtmosphereResourceAtmosphereResponse indefinitely.
Suspending a AtmosphereResponse will tell the underlying container to avoid recycling objects associated
with the current instance, and also to avoid committing a response.
The Framework will output some HTML comments when suspending the response in order to make sure all browsers
work well with suspended responses.suspend in interface AtmosphereResourcepublic AtmosphereResource suspend(long timeout, TimeUnit timeunit)
AtmosphereResourceAtmosphereResponse. Suspending a AtmosphereResponse will tell the underlying
container to avoid recycling objects associated with the current instance, and also to avoid committing response.
Invoking this method when a request is being timed out (e.g. AtmosphereResourceEvent.isResumedOnTimeout()
returns true) has no effect.
suspend in interface AtmosphereResourcetimeout - The maximum amount of time a AtmosphereResponse can be suspended. When the timeout
expires, the AtmosphereResponse will be automatically resumed and committed. Usage of any
methods of a AtmosphereResponse that times out will throw an IllegalStateException.timeunit - The time unit of the timeout valuepublic AtmosphereResource suspend(long timeout)
AtmosphereResourceAtmosphereResponse. Suspending a AtmosphereResponse will tell the underlying
container to avoid recycling objects associated with the current instance, and also to avoid committing response.
Invoking this method when a request is being timed out (e.g. AtmosphereResourceEvent.isResumedOnTimeout()
returns true) has no effect.
suspend in interface AtmosphereResourcetimeout - The maximum amount of time, in milliseconds, a AtmosphereResponse can be suspended. When
the timeout expires, the AtmosphereResponse will be automatically resumed and committed.
Usage of any methods of a AtmosphereResponse that times out will throw an IllegalStateException.public AtmosphereRequest getRequest(boolean enforceScope)
public AtmosphereResponse getResponse(boolean enforceScope)
public AtmosphereRequest getRequest()
AtmosphereResourceAtmosphereRequest request.getRequest in interface AtmosphereResourceAtmosphereRequest the underlying request.public AtmosphereResponse getResponse()
AtmosphereResourceAtmosphereResponse.getResponse in interface AtmosphereResourceAtmosphereResponse the underlying response.public Broadcaster getBroadcaster()
AtmosphereResourceBroadcaster.getBroadcaster in interface AtmosphereResourceBroadcasterpublic List<Broadcaster> broadcasters()
AtmosphereResourceBroadcasters associated with this resourcebroadcasters in interface AtmosphereResourceBroadcasterprotected Broadcaster getBroadcaster(boolean autoCreate)
public AtmosphereResource setBroadcaster(Broadcaster broadcaster)
AtmosphereResourceBroadcaster associated with this resource. This Broadcaster
will be returned when AtmosphereResource.getBroadcaster() is invoked.setBroadcaster in interface AtmosphereResourcepublic AtmosphereResource addBroadcaster(Broadcaster broadcaster)
AtmosphereResourceBroadcaster with this resource.addBroadcaster in interface AtmosphereResourcepublic AtmosphereResource removeBroadcaster(Broadcaster broadcaster)
AtmosphereResourceBroadcaster with this resource.removeBroadcaster in interface AtmosphereResourceprotected AtmosphereResource uniqueBroadcaster(Broadcaster newB)
public AtmosphereConfig getAtmosphereConfig()
AtmosphereResourceAtmosphereConfig.getAtmosphereConfig in interface AtmosphereResourceAtmosphereConfigpublic Action action()
Action which represent the state of the response, e.g. suspended, resumed or timed out.Actionpublic void reset()
public void setIsInScope(boolean isInScope)
isInScope - public boolean isInScope()
AtmosphereRequest still is valid.AtmosphereRequest still is validpublic AtmosphereResource setSerializer(Serializer s)
Serializer used to write broadcasted objects.setSerializer in interface AtmosphereResources - public boolean isResumed()
AtmosphereResourceisResumed in interface AtmosphereResourcepublic boolean isCancelled()
AtmosphereResourceisCancelled in interface AtmosphereResourcepublic AtmosphereResource write(String s)
AtmosphereResourceAtmosphereResource.resumeOnBroadcast() is true, the underlying connection will be resumed (@link #resume());write in interface AtmosphereResourcepublic AtmosphereResource write(byte[] o)
AtmosphereResourceAtmosphereResource.resumeOnBroadcast() is true, the underlying connection will be resumed (@link #resume());write in interface AtmosphereResourcepublic Serializer getSerializer()
AtmosphereResourceSerializer or null if not defined.getSerializer in interface AtmosphereResourceSerializer or null if not definedpublic AtmosphereResource addEventListener(AtmosphereResourceEventListener e)
addEventListener in interface AtmosphereResourcee - an instance of AtmosphereResourceEventListenerpublic AtmosphereResource removeEventListener(AtmosphereResourceEventListener e)
AtmosphereResourceAtmosphereResourceEventListener.removeEventListener in interface AtmosphereResourcepublic AtmosphereResource removeEventListeners()
AtmosphereResourceAtmosphereResourceEventListeners.removeEventListeners in interface AtmosphereResourcepublic AtmosphereResource notifyListeners()
AtmosphereResourceAtmosphereResourceEventListeners.notifyListeners in interface AtmosphereResourcepublic AtmosphereResource notifyListeners(AtmosphereResourceEvent event)
AtmosphereResourceAtmosphereResourceEventListener.notifyListeners in interface AtmosphereResourceevent - an instance of AtmosphereResourceEventpublic AtmosphereResource removeFromAllBroadcasters()
AtmosphereResourceAtmosphereResource from all BroadcasterremoveFromAllBroadcasters in interface AtmosphereResourcepublic void onThrowable(Throwable t)
AtmosphereResourceEventListener thah an unexpected exception occured.public ConcurrentLinkedQueue<AtmosphereResourceEventListener> atmosphereResourceEventListener()
public AtmosphereResourceImpl atmosphereHandler(AtmosphereHandler atmosphereHandler)
public void cancel()
throws IOException
IOExceptionpublic void _destroy()
public AtmosphereResourceImpl disableSuspend(boolean disableSuspend)
public javax.servlet.http.HttpSession session(boolean create)
AtmosphereResourceHttpSession if supported, and creates it if not already created.session in interface AtmosphereResourceHttpSession if supported, and creates it if not already createdpublic void close()
throws IOException
AtmosphereResourceAtmosphereResource}.close in interface AtmosphereResourceIOExceptionpublic void dirtyClose()
public AtmosphereResource forceBinaryWrite(boolean forceBinaryWrite)
AtmosphereResourceforceBinaryWrite in interface AtmosphereResourcepublic boolean forceBinaryWrite()
AtmosphereResourceforceBinaryWrite in interface AtmosphereResourcepublic javax.servlet.http.HttpSession session()
AtmosphereResourceHttpSession if supported, null if notsession in interface AtmosphereResourceHttpSession if supported, null if notpublic AtmosphereResourceImpl session(javax.servlet.http.HttpSession session)
public AtmosphereResourceImpl cloneState(AtmosphereResource r)
public ConcurrentLinkedQueue<AtmosphereResourceEventListener> listeners()
public AtmosphereResourceImpl disableSuspendEvent(boolean disableSuspendEvent)
AtmosphereResourceEventListener.onSuspend(AtmosphereResourceEvent) and
AtmosphereResourceEventListener.onPreSuspend(AtmosphereResourceEvent). You normally disable those events
after the first onSuspend has been called so all transports behave the same way.
AtmosphereResourceEventListener marked with AllowInterceptor will not
be affected by this property.disableSuspendEvent - public boolean disableSuspendEvent()
AtmosphereResourceEventListener.onSuspend(AtmosphereResourceEvent) and
AtmosphereResourceEventListener.onPreSuspend(AtmosphereResourceEvent) events are disabled.public WebSocket webSocket()
public AtmosphereResourceImpl webSocket(WebSocket webSocket)
public boolean getAndSetInClosingPhase()
public boolean isPendingClose()
public boolean getAndSetPendingClose()
Copyright © 2016. All rights reserved.