Top Description Fields Constructors Methods
org.springframework.web.socket.sockjs.frame

public Class Jackson2SockJsMessageCodec

extends AbstractSockJsMessageCodec
Class Inheritance
Imports
java.io.IOException, .InputStream, com.fasterxml.jackson.core.io.JsonStringEncoder, com.fasterxml.jackson.databind.DeserializationFeature, .MapperFeature, .ObjectMapper, org.springframework.http.converter.json.Jackson2ObjectMapperBuilder, org.springframework.lang.Nullable, org.springframework.util.Assert

A Jackson 2.x codec for encoding and decoding SockJS messages.

It customizes Jackson's default properties with the following ones:

Note that Jackson's JSR-310 and Joda-Time support modules will be registered automatically when available (and when Java 8 and Joda-Time themselves are available, respectively).

Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private final ObjectMapper

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected char[]
public String[]
decode(String
the SockJS message frame
content
)

Implements org.springframework.web.socket.sockjs.frame.SockJsMessageCodec.decode.

Decode the given SockJS message frame.

public String[]
decodeInputStream(InputStream
the SockJS message frame
content
)

Implements org.springframework.web.socket.sockjs.frame.SockJsMessageCodec.decodeInputStream.

Decode the given SockJS message frame.

Inherited from org.springframework.web.socket.sockjs.frame.AbstractSockJsMessageCodec:
encode

Field Detail

objectMapperback to summary
private final ObjectMapper objectMapper

Constructor Detail

Jackson2SockJsMessageCodecback to summary
public Jackson2SockJsMessageCodec()
Jackson2SockJsMessageCodecback to summary
public Jackson2SockJsMessageCodec(ObjectMapper objectMapper)

Method Detail

applyJsonQuotingback to summary
protected char[] applyJsonQuoting(String content)

Implements abstract org.springframework.web.socket.sockjs.frame.AbstractSockJsMessageCodec.applyJsonQuoting.

Doc from org.springframework.web.socket.sockjs.frame.AbstractSockJsMessageCodec.applyJsonQuoting.

Apply standard JSON string quoting (see json.org).

Annotations
@Override
decodeback to summary
public String[] decode(String content) throws IOException

Implements org.springframework.web.socket.sockjs.frame.SockJsMessageCodec.decode.

Doc from org.springframework.web.socket.sockjs.frame.SockJsMessageCodec.decode.

Decode the given SockJS message frame.

Parameters
content:String

the SockJS message frame

Returns:String[]

an array of messages, or null if none

Annotations
@Override
@Nullable
Exceptions
IOException:
if the content could not be parsed
decodeInputStreamback to summary
public String[] decodeInputStream(InputStream content) throws IOException

Implements org.springframework.web.socket.sockjs.frame.SockJsMessageCodec.decodeInputStream.

Doc from org.springframework.web.socket.sockjs.frame.SockJsMessageCodec.decodeInputStream.

Decode the given SockJS message frame.

Parameters
content:InputStream

the SockJS message frame

Returns:String[]

an array of messages, or null if none

Annotations
@Override
@Nullable
Exceptions
IOException:
if the content could not be parsed