|
||||||||||
| 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 AtmosphereRequest.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.atmosphere.cpr.AtmosphereResource |
|---|
AtmosphereResource.TRANSPORT |
| Field Summary | |
|---|---|
protected Action |
action
|
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 final Action action
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()
AtmosphereResourceEvent.
getAtmosphereResourceEvent in interface AtmosphereResourcepublic AtmosphereHandler getAtmosphereHandler()
AtmosphereHandler associated with this resource.
getAtmosphereHandler in interface AtmosphereResourceAtmosphereHandler associated with this resource.public AtmosphereResource writeOnTimeout(Object o)
Object or Callable
writeOnTimeout in interface AtmosphereResourcepublic Object writeOnTimeout()
writeOnTimeout in interface AtmosphereResourcepublic String uuid()
AtmosphereResource
uuid in interface AtmosphereResourcepublic AtmosphereResource.TRANSPORT transport()
AtmosphereResource.TRANSPORT. The transport value is retrieved using the HeaderConfig.X_ATMOSPHERE_TRANSPORT
header value.
transport in interface AtmosphereResourcepublic AtmosphereResource resumeOnBroadcast(boolean resumeOnBroadcast)
resumeOnBroadcast in interface AtmosphereResourcepublic boolean isSuspended()
AtmosphereResource.suspend() has been invoked.
isSuspended in interface AtmosphereResourceAtmosphereResource.suspend() has been invoked.public boolean resumeOnBroadcast()
AtmosphereResource.resumeOnBroadcast()
resumeOnBroadcast in interface AtmosphereResourcepublic AtmosphereResource resume()
AtmosphereResponse and finish/commit it. If the
AtmosphereResponse is in the process of being resumed, invoking
that method has no effect.
resume in interface AtmosphereResourcepublic 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.
suspend in interface AtmosphereResource
public AtmosphereResource suspend(long timeout,
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()
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.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 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()
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()
AtmosphereRequest Request.
getRequest in interface AtmosphereResourceAtmosphereRequest the underlying Request.public AtmosphereResponse getResponse()
AtmosphereResponse
getResponse in interface AtmosphereResourceAtmosphereResponse the underlying Response.public Broadcaster getBroadcaster()
Broadcaster
getBroadcaster in interface AtmosphereResourceBroadcasterprotected Broadcaster getBroadcaster(boolean autoCreate)
public AtmosphereResourceImpl 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.
setBroadcaster in interface AtmosphereResourcepublic AtmosphereConfig getAtmosphereConfig()
AtmosphereConfig
getAtmosphereConfig in interface AtmosphereResourceAtmosphereConfigpublic Action action()
Action which represent the state of the response,
e.g. suspended, resumed or timedout.
Actionpublic void setIsInScope(boolean isInScope)
isInScope - public boolean isInScope()
AtmosphereRequest still valid.
AtmosphereRequest still validpublic AtmosphereResource setSerializer(Serializer s)
Serializer used to write broadcasted object.
setSerializer in interface AtmosphereResources - public boolean isResumed()
isResumed in interface AtmosphereResourcepublic boolean isCancelled()
isCancelled in interface AtmosphereResource
public AtmosphereResource write(OutputStream os,
Object o)
throws IOException
OutputStream. If a
Serializer is defined, the operation will be delagated to it. If
not, the
write in interface AtmosphereResourceos - an OutputStreamo - an Object
IOExceptionpublic Serializer getSerializer()
Serializer or null if not defined.
getSerializer in interface AtmosphereResourceSerializer or null if not defined.public AtmosphereResource addEventListener(AtmosphereResourceEventListener e)
AtmosphereResourceEventListener.
addEventListener in interface AtmosphereResourcee - an instance of AtmosphereResourceEventListenerpublic AtmosphereResource removeEventListener(AtmosphereResourceEventListener e)
AtmosphereResourceEventListener.
removeEventListener in interface AtmosphereResourcepublic AtmosphereResource removeEventListeners()
AtmosphereResourceEventListener.
removeEventListeners in interface AtmosphereResourcepublic AtmosphereResource notifyListeners()
AtmosphereResourceEventListener.
notifyListeners in interface AtmosphereResourcepublic AtmosphereResource notifyListeners(AtmosphereResourceEvent event)
AtmosphereResourceEventListener.
notifyListeners in interface AtmosphereResourceevent - an instance of AtmosphereResourceEventpublic void onThrowable(Throwable t)
AtmosphereResourceEventListener an unexpected exception occured.\
public ConcurrentLinkedQueue<AtmosphereResourceEventListener> atmosphereResourceEventListener()
public AtmosphereResourceImpl atmosphereHandler(AtmosphereHandler atmosphereHandler)
public void cancel()
throws IOException
IOExceptionpublic String toString()
toString in class Objectpublic AtmosphereResourceImpl disableSuspend(boolean disableSuspend)
public javax.servlet.http.HttpSession session(boolean create)
HttpSession is supported, and creates it if not already created.
session in interface AtmosphereResourceHttpSession is supported, and creates it if not already createdpublic javax.servlet.http.HttpSession session()
HttpSession is supported, null if not
session in interface AtmosphereResourceHttpSession is supported, null if notpublic AtmosphereResourceImpl session(javax.servlet.http.HttpSession session)
public AtmosphereResourceImpl cloneState(AtmosphereResource r)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||