Package org.apache.tomcat.websocket.pojo
Class PojoEndpointBase
- java.lang.Object
-
- jakarta.websocket.Endpoint
-
- org.apache.tomcat.websocket.pojo.PojoEndpointBase
-
- Direct Known Subclasses:
PojoEndpointClient,PojoEndpointServer
public abstract class PojoEndpointBase extends Endpoint
Base implementation (client and server have different concrete implementations) of the wrapper that converts a POJO instance into a WebSocket endpoint instance.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPojoEndpointBase(java.util.Map<java.lang.String,java.lang.String> pathParameters)Constructs a new PojoEndpointBase.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoOnOpen(Session session, EndpointConfig config)Handles the WebSocket session open event by adding message handlers and invoking the onOpen method.protected PojoMethodMappinggetMethodMapping()Returns the method mapping for this endpoint.protected java.lang.ObjectgetPojo()Returns the POJO instance wrapped by this endpoint.voidonClose(Session session, CloseReason closeReason)Event that is triggered when a session has closed.voidonError(Session session, java.lang.Throwable throwable)Event that is triggered when a protocol error occurs.protected voidsetMethodMapping(PojoMethodMapping methodMapping)Sets the method mapping for this endpoint.protected voidsetPojo(java.lang.Object pojo)Sets the POJO instance wrapped by this endpoint.
-
-
-
Method Detail
-
doOnOpen
protected final void doOnOpen(Session session, EndpointConfig config)
Handles the WebSocket session open event by adding message handlers and invoking the onOpen method.- Parameters:
session- the WebSocket sessionconfig- the endpoint configuration
-
onClose
public final void onClose(Session session, CloseReason closeReason)
Description copied from class:jakarta.websocket.EndpointEvent that is triggered when a session has closed.
-
onError
public final void onError(Session session, java.lang.Throwable throwable)
Description copied from class:jakarta.websocket.EndpointEvent that is triggered when a protocol error occurs.
-
getPojo
protected java.lang.Object getPojo()
Returns the POJO instance wrapped by this endpoint.- Returns:
- the POJO instance
-
setPojo
protected void setPojo(java.lang.Object pojo)
Sets the POJO instance wrapped by this endpoint.- Parameters:
pojo- the POJO instance
-
getMethodMapping
protected PojoMethodMapping getMethodMapping()
Returns the method mapping for this endpoint.- Returns:
- the method mapping
-
setMethodMapping
protected void setMethodMapping(PojoMethodMapping methodMapping)
Sets the method mapping for this endpoint.- Parameters:
methodMapping- the method mapping
-
-