I'm sending a lots of data as a JSON response in JAX-RS endpoint.

Is there any way to set "always-compress" parameter in javax.ws.rs as annotation to the endpoint or on payara-micro level as parameter, to always compress the response?

The current state is that the endpoint supports both uncompressed and compressed (e.g.curl --compressed) way of providing the data.

@ApiOperation(value = "Provides Json information about some etities")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Transfer successful"),
        @ApiResponse(code = 400, message = "Bad request"),
        @ApiResponse(code = 500, message = "Internal server error")})
public void retrieveTheData() {

I want, that the endpoint will be always responding with compressed data (content-encoding: gzip).

0 Answers