java.lang.Object
com.sun.faces.push.WebsocketFacesListener
- All Implemented Interfaces:
FacesListener,SystemEventListener,EventListener
This Faces listener for UIViewRoot ensures that the necessary JavaScript code to open or close the
WebSocket is properly rendered depending on rendered and connected attributes.
- Since:
- 2.3
- Author:
- Bauke Scholtz
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisListenerForSource(Object source) Only listens onUIViewRoot.static booleanisNew(FacesContext context, UIWebsocket websocket) voidprocessEvent(SystemEvent event) If the websocket has just switched itsrenderedorconnectedattribute, then render either theopen()script or theclose()script.static voidsubscribeIfNecessary(FacesContext context)
-
Constructor Details
-
WebsocketFacesListener
public WebsocketFacesListener()
-
-
Method Details
-
subscribeIfNecessary
-
isNew
-
isListenerForSource
Only listens onUIViewRoot.- Specified by:
isListenerForSourcein 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
If the websocket has just switched itsrenderedorconnectedattribute, 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:
processEventin interfaceSystemEventListener- Parameters:
event- theSystemEventinstance that is being processed.- Throws:
AbortProcessingException- if lifecycle processing should cease for this request.
-