public class WebsocketFacesListener extends Object implements SystemEventListener
This JSF listener for UIViewRoot
ensures that the necessary JavaScript code to open or close the
WebSocket
is properly rendered depending on rendered
and connected
attributes.
Push
Constructor and Description |
---|
WebsocketFacesListener() |
Modifier and Type | Method and Description |
---|---|
boolean |
isListenerForSource(Object source)
Only listens on
UIViewRoot . |
static boolean |
isNew(FacesContext context,
UIWebsocket websocket) |
void |
processEvent(SystemEvent event)
If the websocket has just switched its
rendered or connected attribute, then
render either the open() script or the close() script. |
static void |
subscribeIfNecessary(FacesContext context) |
public static void subscribeIfNecessary(FacesContext context)
public static boolean isNew(FacesContext context, UIWebsocket websocket)
public boolean isListenerForSource(Object source)
UIViewRoot
.isListenerForSource
in interface SystemEventListener
source
- the source that is inquiring about the
appropriateness of sending an event to this listener instance.public void processEvent(SystemEvent event) throws AbortProcessingException
rendered
or connected
attribute, then
render either the open()
script or the close()
script. During an ajax request with
partial rendering, it's added as <eval>
by partial response writer, else it's just added
as a script component with target="body"
.processEvent
in interface SystemEventListener
event
- the SystemEvent
instance that
is being processed.AbortProcessingException
- if lifecycle processing should
cease for this request.Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.