|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cpr.AtmosphereResourceImpl
public class AtmosphereResourceImpl
AtmosphereResource implementation for supporting AtmosphereRequest
and AtmosphereResponse.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.atmosphere.cpr.AtmosphereResource |
|---|
AtmosphereResource.TRANSPORT |
| Field Summary | |
|---|---|
protected AsyncSupport |
asyncSupport
|
protected Broadcaster |
broadcaster
|
static String |
METEOR
|
static String |
PRE_SUSPEND
|
protected javax.servlet.http.HttpSession |
session
|
static String |
SKIP_BROADCASTER_CREATION
|
| Constructor Summary | |
|---|---|
AtmosphereResourceImpl(AtmosphereConfig config,
Broadcaster broadcaster,
AtmosphereRequest req,
AtmosphereResponse response,
AsyncSupport asyncSupport,
AtmosphereHandler atmosphereHandler)
Create an AtmosphereResource. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String PRE_SUSPEND
public static final String SKIP_BROADCASTER_CREATION
public static final String METEOR
protected Broadcaster broadcaster
protected final AsyncSupport asyncSupport
protected javax.servlet.http.HttpSession session
| Constructor Detail |
|---|
public AtmosphereResourceImpl(AtmosphereConfig config,
Broadcaster broadcaster,
AtmosphereRequest req,
AtmosphereResponse response,
AsyncSupport asyncSupport,
AtmosphereHandler atmosphereHandler)
AtmosphereResource.
config - The AtmosphereConfigbroadcaster - The Broadcaster.req - The AtmosphereRequestresponse - The AtmosphereResourceasyncSupport - The AsyncSupportatmosphereHandler - The AtmosphereHandler| Method Detail |
|---|
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)
AtmosphereResourceObject or Callable.
writeOnTimeout in interface AtmosphereResourcepublic Object writeOnTimeout()
AtmosphereResource
writeOnTimeout in interface AtmosphereResourcepublic String uuid()
AtmosphereResource
uuid 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)
TRANSPORT
transport - set the TRANSPORT
public AtmosphereResource resumeOnBroadcast(boolean resumeOnBroadcast)
AtmosphereResource
resumeOnBroadcast in interface AtmosphereResourcepublic boolean isSuspended()
AtmosphereResourceAtmosphereResource.suspend() has been invoked.
isSuspended in interface AtmosphereResourceAtmosphereResource.suspend() has been invokedpublic boolean resumeOnBroadcast()
AtmosphereResource
resumeOnBroadcast 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 AtmosphereResource
public 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.
The Framework will output some HTML comments when suspending the response in order to make sure all browsers
work well with suspended responses. By default, the AtmosphereResponse.getWriter() will be used. You can
change that behavior by setting a request attribute named org.atmosphere.useStream so the framework will
use AtmosphereResponse.getOutputStream().
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.
The Framework will output some HTML comments when suspending the response in order to make sure all browsers
work well with suspended responses. By default, the AtmosphereResponse.getWriter() will be used. You can
change that behavior by setting a request attribute named org.atmosphere.useStream so the framework will
use AtmosphereResponse.getOutputStream().
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 AtmosphereResourceBroadcasterprotected Broadcaster getBroadcaster(boolean autoCreate)
public AtmosphereResourceImpl setBroadcaster(Broadcaster broadcaster)
AtmosphereResourceBroadcaster. If null, a new Broadcaster will be created with Broadcaster.SCOPE.REQUEST
if that resource hasn't been suspended yet.
setBroadcaster in interface AtmosphereResourcepublic 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()
AtmosphereResource
isResumed in interface AtmosphereResourcepublic boolean isCancelled()
AtmosphereResource
isCancelled 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)
AtmosphereResourceEventListener.
addEventListener in interface AtmosphereResourcee - an instance of AtmosphereResourceEventListener
public 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 AtmosphereResourceEvent
public 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 String toString()
toString in class Objectpublic 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 created
public void close()
throws IOException
AtmosphereResourceAtmosphereResource}.
close in interface AtmosphereResourceIOExceptionpublic javax.servlet.http.HttpSession session()
AtmosphereResourceHttpSession if supported, null if not
session in interface AtmosphereResourceHttpSession if supported, null if notpublic AtmosphereResourceImpl session(javax.servlet.http.HttpSession session)
public AtmosphereResourceImpl cloneState(AtmosphereResource r)
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||