Top Description Fields Constructors Methods
com.sun.faces.push

public Class WebsocketEndpoint

extends Endpoint
Class Inheritance
Static Imports
javax.faces.push.PushContext.URI_PREFIX, javax.websocket.CloseReason.CloseCodes.GOING_AWAY, .CloseReason.CloseCodes.VIOLATED_POLICY

This web socket server endpoint handles web socket requests coming from <f:websocket>.

Author
Bauke Scholtz
Since
2.3
See Also
Push

Field Summary

Modifier and TypeField and Description
private static final String
private static final Logger
pack-priv static final String
PARAM_CHANNEL

The URI path parameter name of the web socket channel.

private static final CloseReason
public static final String
URI_TEMPLATE

The context-relative URI template where the web socket endpoint should listen on.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
onClose(Session
The closed web socket session.
session
,
CloseReason
The close reason.
reason
)

Overrides javax.websocket.Endpoint.onClose.

Remove given web socket session from the WebsocketSessionManager.
public void
onError(Session
The errored web socket session.
session
,
Throwable
The cause.
throwable
)

Overrides javax.websocket.Endpoint.onError.

Delegate exception to onClose.
public void
onOpen(Session
The opened web socket session.
session
,
EndpointConfig
The endpoint configuration.
config
)

Implements abstract javax.websocket.Endpoint.onOpen.

Add given web socket session to the WebocketSessionManager.

Field Detail

ERROR_EXCEPTIONback to summary
private static final String ERROR_EXCEPTION
loggerback to summary
private static final Logger logger
PARAM_CHANNELback to summary
pack-priv static final String PARAM_CHANNEL

The URI path parameter name of the web socket channel.

REASON_UNKNOWN_CHANNELback to summary
private static final CloseReason REASON_UNKNOWN_CHANNEL
URI_TEMPLATEback to summary
public static final String URI_TEMPLATE

The context-relative URI template where the web socket endpoint should listen on.

Constructor Detail

WebsocketEndpointback to summary
public WebsocketEndpoint()

Method Detail

onCloseback to summary
public void onClose(Session session, CloseReason reason)

Overrides javax.websocket.Endpoint.onClose.

Remove given web socket session from the WebsocketSessionManager. If there is any exception from onError which was not caused by GOING_AWAY, then log it. Tomcat <= 8.0.30 is known to throw an unnecessary exception when client abruptly disconnects, see also issue 57489.

Parameters
session:Session

The closed web socket session.

reason:CloseReason

The close reason.

Annotations
@Override
onErrorback to summary
public void onError(Session session, Throwable throwable)

Overrides javax.websocket.Endpoint.onError.

Delegate exception to onClose.

Parameters
session:Session

The errored web socket session.

throwable:Throwable

The cause.

Annotations
@Override
onOpenback to summary
public void onOpen(Session session, EndpointConfig config)

Implements abstract javax.websocket.Endpoint.onOpen.

Add given web socket session to the WebocketSessionManager. If web socket session is not accepted (i.e. the channel identifier is unknown), then immediately close with reason VIOLATED_POLICY (close code 1008).

Parameters
session:Session

The opened web socket session.

config:EndpointConfig

The endpoint configuration.

Annotations
@Override