org.springframework.web.socket.sockjs.frame

## Class Jackson2SockJsMessageCodec

- java.lang.Object
- - org.springframework.web.socket.sockjs.frame.AbstractSockJsMessageCodec
  - - org.springframework.web.socket.sockjs.frame.Jackson2SockJsMessageCodec

All Implemented Interfaces:
  SockJsMessageCodec

    public class Jackson2SockJsMessageCodec
    extends AbstractSockJsMessageCodec

A Jackson 2.6+ codec for encoding and decoding SockJS messages.

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

- `MapperFeature.DEFAULT_VIEW_INCLUSION` is disabled
- `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES` is disabled

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).

Since:
  4.0
Author:
  Rossen Stoyanchev

### Constructor Summary

Constructors
Constructor and Description
`Jackson2SockJsMessageCodec()`
`Jackson2SockJsMessageCodec(ObjectMapper objectMapper)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected char[]` `applyJsonQuoting(String content)` Apply standard JSON string quoting (see https://www.json.org/).
`String[]` `decode(String content)` Decode the given SockJS message frame.
`String[]` `decodeInputStream(InputStream content)` Decode the given SockJS message frame.

### Methods inherited from class org.springframework.web.socket.sockjs.frame.AbstractSockJsMessageCodec

`encode`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Jackson2SockJsMessageCodec

    public Jackson2SockJsMessageCodec()

#### Jackson2SockJsMessageCodec

    public Jackson2SockJsMessageCodec(ObjectMapper objectMapper)

### Method Detail

#### decode

    @Nullable
    public String[] decode(String content)
                              throws IOException

Description copied from interface: `SockJsMessageCodec`
Decode the given SockJS message frame.

Parameters:
  `content` - the SockJS message frame
Returns:
  an array of messages, or `null` if none
Throws:
  `IOException` - if the content could not be parsed

#### decodeInputStream

    @Nullable
    public String[] decodeInputStream(InputStream content)
                                         throws IOException

Description copied from interface: `SockJsMessageCodec`
Decode the given SockJS message frame.

Parameters:
  `content` - the SockJS message frame
Returns:
  an array of messages, or `null` if none
Throws:
  `IOException` - if the content could not be parsed

#### applyJsonQuoting

    protected char[] applyJsonQuoting(String content)

Description copied from class: `AbstractSockJsMessageCodec`
Apply standard JSON string quoting (see https://www.json.org/).

Specified by:
  `applyJsonQuoting` in class `AbstractSockJsMessageCodec`