Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
panterose opened this issue Oct 24, 2017 · 4 comments
Closed

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

panterose opened this issue Oct 24, 2017 · 4 comments
Assignees
Labels
status: invalid An issue that we don't feel is valid

Comments

@panterose
Copy link

panterose commented Oct 24, 2017

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;
    }
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 24, 2017
@wilkinsona
Copy link
Member

Thanks for the code snippets, but they don't really give us enough information to diagnose the issue. Can you please provide a small, complete sample (something that we can unzip or clone and run) that reproduces the problem?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Oct 24, 2017
@panterose
Copy link
Author

Here is a minimal project:
smile.zip

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 26, 2017
@wilkinsona wilkinsona self-assigned this Oct 27, 2017
@wilkinsona
Copy link
Member

Thanks. Your test shows that this isn't a Spring Boot problem as SmileStreamTest doesn't use any of Spring Boot. It also doesn't have a dependency on jackson-dataformat-smile, however adding that dependency does not fix the problem. The problem appears to be that Jackson2SmileEncoder does not, by default, include stream+x-jackson-smile in the media types that it supports. If my analysis is correct, this will need to be corrected in Spring Framework.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Oct 27, 2017
@bclozel
Copy link
Member

bclozel commented Dec 22, 2017

For reference: SPR-16151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants