Skip to content

"stream+x-jackson-smile" is not supported by default #10756

@panterose

Description

@panterose

I can see the encoder and its test support this media-type, but when I try it on a sample project, it doesn't work. I want Smile (or CBOR) because our service sends lots of matrices and JSON is really inefficient compare to binary serialisation for numerical data.

Simplest reproducer:

@Test
public void binaryContent() throws Exception {
    WebTestClient.bindToController(new MatrixController()).build()
        .get().uri("/matrix")
        .header("Accept", "application/stream+x-jackson-smile")
        .exchange()
        .expectStatus().isOk()
        .returnResult(Matrix.class)
        .getResponseBody()
        .toIterable()
        .forEach(m -> System.out.println(m));
}

@RestController
static class MatrixController {
    @GetMapping(value = "/matrix", produces = {"application/stream+x-jackson-smile"})
    Flux<Matrix> getMatrix() {
        return Flux.range(0,1000)
                .subscribeOn(Schedulers.single())
                .map(i -> new Matrix(100,1000))
                ;
    }
}

public static class Matrix {
    private double[] array;
    public Matrix() {}
    public Matrix(int rows, int columns) {
        this.array = new double[rows * columns];
    }
    public double[] getArray() {
        return array;
    }
    public void setArray(double[] array) {
        this.array = array;
    }
}

Metadata

Metadata

Assignees

Labels

status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions