public class AtmosphereBehavior extends AbstractAjaxBehavior implements org.atmosphere.cpr.AtmosphereResourceEventListener
AtmosphereBehavior
manages the suspended connection from the client. It adds the required
javascript libraries to the markup which setup a suspended connection. This connection can be
websocket, streaming http or long-polling, depending on what the client and server support. This
behavior is added automatically to pages with components with event subscriptions.Modifier and Type | Field and Description |
---|---|
static MetaDataKey<String> |
ATMOSPHERE_UUID
The key under which a unique id is stored in the page.
|
INTERFACE
Constructor and Description |
---|
AtmosphereBehavior()
Construct.
|
Modifier and Type | Method and Description |
---|---|
CharSequence |
getCallbackUrl()
Make it look like a normal Ajax call so the page id/renderCount are not incremented when Atmosphere makes
the "upgrade" request
|
boolean |
getStatelessHint(Component component)
This method returns false if the behavior generates a callback url (for example ajax
behaviors)
|
static String |
getUUID(org.atmosphere.cpr.AtmosphereResource resource)
Deprecated.
use
AtmosphereResource.uuid() |
static String |
getUUID(Page page)
Find the Atmosphere UUID for the suspended connection for the given page (if any).
|
void |
onBroadcast(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onClose(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onDisconnect(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onHeartbeat(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onPreSuspend(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onRequest()
Called when a request to a behavior is received.
|
void |
onResume(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onSuspend(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
onThrowable(org.atmosphere.cpr.AtmosphereResourceEvent event) |
void |
renderHead(Component component,
IHeaderResponse response)
Render to the web response whatever the component wants to contribute to the head section.
|
afterRender, bind, getComponent, onBind, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
beforeRender, canCallListenerInterface, detach, isEnabled, isTemporary, onConfigure, onEvent, onException, onRemove
public static final MetaDataKey<String> ATMOSPHERE_UUID
public final boolean getStatelessHint(Component component)
Behavior
getStatelessHint
in class Behavior
component
- the component that has this behavior coupled.public void onPreSuspend(org.atmosphere.cpr.AtmosphereResourceEvent event)
onPreSuspend
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onClose(org.atmosphere.cpr.AtmosphereResourceEvent event)
onClose
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onRequest()
IBehaviorListener
onRequest
in interface IBehaviorListener
public void onBroadcast(org.atmosphere.cpr.AtmosphereResourceEvent event)
onBroadcast
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onSuspend(org.atmosphere.cpr.AtmosphereResourceEvent event)
onSuspend
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onResume(org.atmosphere.cpr.AtmosphereResourceEvent event)
onResume
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onDisconnect(org.atmosphere.cpr.AtmosphereResourceEvent event)
onDisconnect
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onThrowable(org.atmosphere.cpr.AtmosphereResourceEvent event)
onThrowable
in interface org.atmosphere.cpr.AtmosphereResourceEventListener
public void onHeartbeat(org.atmosphere.cpr.AtmosphereResourceEvent event)
onHeartbeat
in interface org.atmosphere.cpr.AtmosphereResourceHeartbeatEventListener
public void renderHead(Component component, IHeaderResponse response)
Behavior
renderHead
in interface IComponentAwareHeaderContributor
renderHead
in class Behavior
component
- component which is contributing to the response. This parameter is here to give
the component as the context for component-awares implementing this interfaceresponse
- Response objectpublic CharSequence getCallbackUrl()
getCallbackUrl
in class AbstractAjaxBehavior
public static String getUUID(Page page)
page
- @Deprecated public static String getUUID(org.atmosphere.cpr.AtmosphereResource resource)
AtmosphereResource.uuid()
resource
- Copyright © 2006–2021 Apache Software Foundation. All rights reserved.