Class PojoEndpointBase
java.lang.Object
jakarta.websocket.Endpoint
org.apache.tomcat.websocket.pojo.PojoEndpointBase
- Direct Known Subclasses:
PojoEndpointClient, PojoEndpointServer
Base implementation (client and server have different concrete implementations) of the wrapper that converts a POJO
instance into a WebSocket endpoint instance.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPojoEndpointBase(Map<String, String> pathParameters) Constructs a new PojoEndpointBase. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voiddoOnOpen(Session session, EndpointConfig config) Handles the WebSocket session open event by adding message handlers and invoking the onOpen method.protected PojoMethodMappingReturns the method mapping for this endpoint.getPojo()Returns the POJO instance wrapped by this endpoint.final voidonClose(Session session, CloseReason closeReason) Event that is triggered when a session has closed.final voidEvent that is triggered when a protocol error occurs.protected voidsetMethodMapping(PojoMethodMapping methodMapping) Sets the method mapping for this endpoint.protected voidSets the POJO instance wrapped by this endpoint.
-
Constructor Details
-
PojoEndpointBase
-
-
Method Details
-
doOnOpen
Handles the WebSocket session open event by adding message handlers and invoking the onOpen method.- Parameters:
session- the WebSocket sessionconfig- the endpoint configuration
-
onClose
Description copied from class:jakarta.websocket.EndpointEvent that is triggered when a session has closed. -
onError
Description copied from class:jakarta.websocket.EndpointEvent that is triggered when a protocol error occurs. -
getPojo
Returns the POJO instance wrapped by this endpoint. This is the instance that the container's instance manager created (or registered) so, when the session using this endpoint closes, it is this instance and not the wrapper that must be passed to the instance manager to destroy it.- Returns:
- the POJO instance
-
setPojo
Sets the POJO instance wrapped by this endpoint.- Parameters:
pojo- the POJO instance
-
getMethodMapping
Returns the method mapping for this endpoint.- Returns:
- the method mapping
-
setMethodMapping
Sets the method mapping for this endpoint.- Parameters:
methodMapping- the method mapping
-