String or ByteBuffer)
jakarta.websocket.Encoder
and/or jakarta.websocket.Decoder . It provides encode and decode method
implementations that delegate to a Spring ConversionService.
By default, this class looks up a ConversionService registered in the
active ApplicationContext under
the name 'webSocketConversionService'. This works fine for both client
and server endpoints, in a Servlet container environment. If not running in a
Servlet container, subclasses will need to override the
getConversionService() method to provide an alternative lookup strategy.
Subclasses can extend this class and should also implement one or
both of jakarta. and jakarta..
For convenience ConvertingEncoderDecoderSupport.,
ConvertingEncoderDecoderSupport.,
ConvertingEncoderDecoderSupport. and
ConvertingEncoderDecoderSupport. subclasses are provided.
Since JSR-356 only allows Encoder/Decoder to be registered by type, instances
of this class are therefore managed by the WebSocket runtime, and do not need to
be registered as Spring Beans. They can, however, by injected with Spring-managed
dependencies via @Autowire.
Converters to convert between the type and String or
ByteBuffer should be registered.
ConvertingEncoderDecoderSupport.BinaryEncoder , ConvertingEncoderDecoderSupport.BinaryDecoder , ConvertingEncoderDecoderSupport.TextEncoder , ConvertingEncoderDecoderSupport.TextDecoder
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | ConvertingEncoderDecoderSupport.
the type that this Decoder can convert from T>A binary |
| public abstract static class | ConvertingEncoderDecoderSupport.
the type that this Encoder can convert to T>A binary |
| public abstract static class | ConvertingEncoderDecoderSupport.
the type that this Decoder can convert from T>A Text |
| public abstract static class | ConvertingEncoderDecoderSupport.
the type that this Encoder can convert to T>A text |
| Modifier and Type | Field and Description |
|---|---|
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public T | |
| public void | |
| public M | |
| protected ApplicationContext | |
| protected ConversionService | Returns: theConversionService (never null)Strategy method used to obtain the |
| protected TypeDescriptor | |
| protected TypeDescriptor | |
| public void | |
| private Class | |
| public boolean |
| CONVERSION_SERVICE_BEAN_NAME | back to summary |
|---|---|
| private static final String CONVERSION_SERVICE_BEAN_NAME | |
| ConvertingEncoderDecoderSupport | back to summary |
|---|---|
| public ConvertingEncoderDecoderSupport() | |
| decode | back to summary |
|---|---|
| public T decode(M message) throws DecodeException Decode the message into an object.
| |
| destroy | back to summary |
|---|---|
| public void destroy() Called to destroy the encoder/decoder. | |
| encode | back to summary |
|---|---|
| public M encode(T object) throws EncodeException Encode an object to a message.
| |
| getApplicationContext | back to summary |
|---|---|
| protected ApplicationContext getApplicationContext() Returns the active
| |
| getConversionService | back to summary |
|---|---|
| protected ConversionService getConversionService() Strategy method used to obtain the
| |
| getMessageType | back to summary |
|---|---|
| protected TypeDescriptor getMessageType() Returns the websocket message type. By default, the type is resolved using the generic arguments of the class. | |
| getType | back to summary |
|---|---|
| protected TypeDescriptor getType() Returns the type being converted. By default, the type is resolved using the generic arguments of the class. | |
| init | back to summary |
|---|---|
| public void init(EndpointConfig config) Called to initialize the encoder/decoder. | |
| resolveTypeArguments | back to summary |
|---|---|
| private Class | |
| willDecode | back to summary |
|---|---|
| public boolean willDecode(M bytes) Determine if a given message can be decoded. | |
jakarta.websocket.Encoder that delegates
to Spring's conversion service. See ConvertingEncoderDecoderSupport for details.
| Access | Constructor and Description |
|---|---|
| public |
| BinaryDecoder | back to summary |
|---|---|
| public BinaryDecoder() | |
jakarta.websocket.Encoder that delegates
to Spring's conversion service. See ConvertingEncoderDecoderSupport for details.
| Access | Constructor and Description |
|---|---|
| public |
| BinaryEncoder | back to summary |
|---|---|
| public BinaryEncoder() | |
jakarta.websocket.Encoder that delegates
to Spring's conversion service. See ConvertingEncoderDecoderSupport for details.
| Access | Constructor and Description |
|---|---|
| public |
| TextDecoder | back to summary |
|---|---|
| public TextDecoder() | |
jakarta.websocket.Encoder that delegates
to Spring's conversion service. See ConvertingEncoderDecoderSupport for
details.
| Access | Constructor and Description |
|---|---|
| public |
| TextEncoder | back to summary |
|---|---|
| public TextEncoder() | |