Package com.sun.faces.push
Class WebsocketFacesListener
- java.lang.Object
-
- com.sun.faces.push.WebsocketFacesListener
-
- All Implemented Interfaces:
FacesListener
,SystemEventListener
,EventListener
public class WebsocketFacesListener extends Object implements SystemEventListener
This Faces listener for
UIViewRoot
ensures that the necessary JavaScript code to open or close theWebSocket
is properly rendered depending onrendered
andconnected
attributes.- Since:
- 2.3
- Author:
- Bauke Scholtz
- See Also:
Push
-
-
Constructor Summary
Constructors Constructor Description WebsocketFacesListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isListenerForSource(Object source)
Only listens onUIViewRoot
.static boolean
isNew(FacesContext context, UIWebsocket websocket)
void
processEvent(SystemEvent event)
If the websocket has just switched itsrendered
orconnected
attribute, then render either theopen()
script or theclose()
script.static void
subscribeIfNecessary(FacesContext context)
-
-
-
Method Detail
-
subscribeIfNecessary
public static void subscribeIfNecessary(FacesContext context)
-
isNew
public static boolean isNew(FacesContext context, UIWebsocket websocket)
-
isListenerForSource
public boolean isListenerForSource(Object source)
Only listens onUIViewRoot
.- Specified by:
isListenerForSource
in interfaceSystemEventListener
- Parameters:
source
- the source that is inquiring about the appropriateness of sending an event to this listener instance.- Returns:
- the value as specified above
-
processEvent
public void processEvent(SystemEvent event) throws AbortProcessingException
If the websocket has just switched itsrendered
orconnected
attribute, then render either theopen()
script or theclose()
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 withtarget="body"
.- Specified by:
processEvent
in interfaceSystemEventListener
- Parameters:
event
- theSystemEvent
instance that is being processed.- Throws:
AbortProcessingException
- if lifecycle processing should cease for this request.
-
-