public interface AtmosphereResource
AtmosphereResource encapsulates the mechanism to suspend(),
resume() and broadcast (getBroadcaster()) messages among
suspended response. AtmosphereResource are passed at runtime to an
instance of AtmosphereHandler.| Modifier and Type | Interface and Description |
|---|---|
static class |
AtmosphereResource.TRANSPORT |
| Modifier and Type | Method and Description |
|---|---|
AtmosphereResource |
addEventListener(AtmosphereResourceEventListener e)
|
AtmosphereConfig |
getAtmosphereConfig()
Return the
AtmosphereConfig |
AtmosphereHandler |
getAtmosphereHandler()
Return the associated
AtmosphereHandler associated with this resource. |
AtmosphereResourceEvent |
getAtmosphereResourceEvent()
Return the current
AtmosphereResourceEvent. |
Broadcaster |
getBroadcaster()
Return the current
Broadcaster |
AtmosphereRequest |
getRequest()
Return the underlying
AtmosphereRequest Request. |
AtmosphereResponse |
getResponse()
Return the
AtmosphereResponse |
Serializer |
getSerializer()
Get the
Serializer or null if not defined. |
boolean |
isCancelled()
Return true if this object has been cancelled.
|
boolean |
isResumed()
Return true if this object has been resumed.
|
boolean |
isSuspended()
Return true is the
suspend() has been invoked. |
AtmosphereResource |
notifyListeners()
Notify All
AtmosphereResourceEventListener. |
AtmosphereResource |
notifyListeners(AtmosphereResourceEvent e)
Notify
AtmosphereResourceEventListener. |
AtmosphereResource |
padding(java.lang.String padding)
Set the padding to use when flushing the response when transport equals 'streaming' See
ApplicationConfig.STREAMING_PADDING_MODE
for more info. |
AtmosphereResource |
removeEventListener(AtmosphereResourceEventListener e)
Remove a
AtmosphereResourceEventListener. |
AtmosphereResource |
removeEventListeners()
Remove all
AtmosphereResourceEventListener. |
AtmosphereResource |
resume()
Complete the
AtmosphereResponse and finish/commit it. |
boolean |
resumeOnBroadcast()
Return the is the
resumeOnBroadcast() |
AtmosphereResource |
resumeOnBroadcast(boolean resumeOnBroadcast)
Set to true to resume the response once after the first broadcast.
|
javax.servlet.http.HttpSession |
session()
Return the
HttpSession is supported, null if not |
javax.servlet.http.HttpSession |
session(boolean create)
Return the
HttpSession is supported, and creates it if not already created. |
AtmosphereResource |
setBroadcaster(Broadcaster broadcaster)
Set the current
Broadcaster. |
AtmosphereResource |
setSerializer(Serializer s)
Set the
Serializer to use when write(java.io.OutputStream, java.lang.Object)
execute the operation. |
AtmosphereResource |
suspend()
Suspend the
AtmosphereResponse indefinitely. |
AtmosphereResource |
suspend(long timeout)
Suspend the
AtmosphereResponse. |
AtmosphereResource |
suspend(long timeout,
boolean flushComment)
Suspend the
AtmosphereResponse. |
AtmosphereResource |
suspend(long timeout,
java.util.concurrent.TimeUnit timeunit)
Suspend the
AtmosphereResponse. |
AtmosphereResource |
suspend(long timeout,
java.util.concurrent.TimeUnit timeunit,
boolean flushComment)
Suspend the
AtmosphereResponse. |
AtmosphereResource.TRANSPORT |
transport()
Return the current
AtmosphereResource.TRANSPORT. |
java.lang.String |
uuid()
Return the unique ID associated with this AtmosphereResource.
|
AtmosphereResource |
write(java.io.OutputStream os,
java.lang.Object o)
|
java.lang.Object |
writeOnTimeout()
Return the object that will be written when the resource times out;
|
AtmosphereResource |
writeOnTimeout(java.lang.Object o)
Set a message that will be written when the resource times out.
|
AtmosphereResource.TRANSPORT transport()
AtmosphereResource.TRANSPORT. The transport value is retrieved using the HeaderConfig.X_ATMOSPHERE_TRANSPORT
header value.AtmosphereResource resumeOnBroadcast(boolean resumeOnBroadcast)
resumeOnBroadcast - boolean isSuspended()
suspend() has been invoked.suspend() has been invoked.boolean resumeOnBroadcast()
resumeOnBroadcast()boolean isResumed()
boolean isCancelled()
AtmosphereResource resume()
AtmosphereResponse and finish/commit it. If the
AtmosphereResponse is in the process of being resumed, invoking
that method has no effect.AtmosphereResource suspend()
AtmosphereResponse indefinitely.
Suspending a AtmosphereResponse will
tell the underlying container to avoid recycling objects associated with
the current instance, and also to avoid commiting response.
The Framework will output some HTML comments when suspending the response
in order to make sure all Browser works well with suspended response.AtmosphereResource suspend(long timeout)
AtmosphereResponse. Suspending a AtmosphereResponse will
tell the underlying container to avoid recycling objects associated with
the current instance, and also to avoid commiting response. Invoking
this method when a request is being timed out, e.g. AtmosphereResourceEvent.isResumedOnTimeout() return true,
has no effect.
The Framework will output some HTML comments when suspending the response
in order to make sure all Browser works well with suspended response. By default,
the AtmosphereResponse.getWriter() will be used. You can change that
behavior by setting a request attribute named org.atmosphere.useStream to
so the framework will use AtmosphereResponse.getOutputStream()timeout - 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.AtmosphereResource suspend(long timeout, java.util.concurrent.TimeUnit timeunit)
AtmosphereResponse. Suspending a AtmosphereResponse will
tell the underlying container to avoid recycling objects associated with
the current instance, and also to avoid commiting response. Invoking
this method when a request is being timed out, e.g. AtmosphereResourceEvent.isResumedOnTimeout() return true,
has no effect.
The Framework will output some HTML comments when suspending the response
in order to make sure all Browser works well with suspended response. By default,
the AtmosphereResponse.getWriter() will be used. You can change that
behavior by setting a request attribute named org.atmosphere.useStream to
so the framework will use AtmosphereResponse.getOutputStream()timeout - 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.timeunit - The time unit of the timeout valueAtmosphereResource suspend(long timeout, boolean flushComment)
AtmosphereResponse. Suspending a AtmosphereResponse will
tell the underlying container to avoid recycling objects associated with
the current instance, and also to avoid commiting response. Invoking
this method when a request is being timed out, e.g. AtmosphereResourceEvent.isResumedOnTimeout() return true,
has no effect.
The Framework will output some HTML comments when suspending the response
in order to make sure all Browser works well with suspended response. By default,
the AtmosphereResponse.getWriter() will be used. You can change that
behavior by setting a request attribute named org.atmosphere.useStream to
so the framework will use AtmosphereResponse.getOutputStream()timeout - 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.flushComment - By default, Atmosphere will output some comments to make WebKit based
browser working. Set it to false if you want to remove it.AtmosphereResource suspend(long timeout, java.util.concurrent.TimeUnit timeunit, boolean flushComment)
AtmosphereResponse. Suspending a AtmosphereResponse will
tell the underlying container to avoid recycling objects associated with
the current instance, and also to avoid commiting response. Invoking
this method when a request is being timed out, e.g. AtmosphereResourceEvent.isResumedOnTimeout() return true,
has no effect.
The Framework will output some HTML comments when suspending the response
in order to make sure all Browser works well with suspended response. By default,
the AtmosphereResponse.getWriter() will be used. You can change that
behavior by setting a request attribute named org.atmosphere.useStream to
so the framework will use AtmosphereResponse.getOutputStream()timeout - 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.timeunit - The time unit of the timeout valueflushComment - By default, Atmosphere will output some comments to make WebKit based
browser working. Set it to false if you want to remove it.AtmosphereRequest getRequest()
AtmosphereRequest Request.AtmosphereRequest the underlying Request.AtmosphereResponse getResponse()
AtmosphereResponseAtmosphereResponse the underlying Response.AtmosphereConfig getAtmosphereConfig()
AtmosphereConfigAtmosphereConfigBroadcaster getBroadcaster()
BroadcasterBroadcasterAtmosphereResource setBroadcaster(Broadcaster broadcaster)
Broadcaster. If null, a new Broadcaster will be created with Broadcaster.SCOPE.REQUEST
will be created if that resource hasn't been yet suspended.broadcaster - AtmosphereResource setSerializer(Serializer s)
Serializer to use when write(java.io.OutputStream, java.lang.Object)
execute the operation. By default, the Serializer is null.s - the SerializerAtmosphereResource write(java.io.OutputStream os, java.lang.Object o) throws java.io.IOException
Object using the OutputStream by invoking
the current Serializer. If Serializer is null, the Object
will be directly written using the AtmosphereResponse writer.os - OutputStreamo - Objectjava.io.IOExceptionSerializer getSerializer()
Serializer or null if not defined.Serializer or null if not defined.AtmosphereResourceEvent getAtmosphereResourceEvent()
AtmosphereResourceEvent.AtmosphereHandler getAtmosphereHandler()
AtmosphereHandler associated with this resource.AtmosphereHandler associated with this resource.AtmosphereResource writeOnTimeout(java.lang.Object o)
Object or Callablejava.lang.Object writeOnTimeout()
java.lang.String uuid()
AtmosphereResource addEventListener(AtmosphereResourceEventListener e)
e - an instance of AtmosphereResourceEventListenerAtmosphereResource removeEventListener(AtmosphereResourceEventListener e)
AtmosphereResourceEventListener.e - AtmosphereResource removeEventListeners()
AtmosphereResourceEventListener.AtmosphereResource notifyListeners(AtmosphereResourceEvent e)
AtmosphereResourceEventListener.e - an instance of AtmosphereResourceEventAtmosphereResource notifyListeners()
AtmosphereResourceEventListener.javax.servlet.http.HttpSession session()
HttpSession is supported, null if notHttpSession is supported, null if notjavax.servlet.http.HttpSession session(boolean create)
HttpSession is supported, and creates it if not already created.HttpSession is supported, and creates it if not already createdAtmosphereResource padding(java.lang.String padding)
ApplicationConfig.STREAMING_PADDING_MODE
for more info.Copyright © 2018. All Rights Reserved.