Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resteasy generally enable GZIP

I have a RestEasy + Java EE application. When I add @GZIP to a component class, the server-answer is gzipped, if the client sends "accepts:gzip"

Is there a way to generally enable gzip for all components? I don't like to add the annotation to every class.

I'm using RestEasy JAX-RS 3.0.1

like image 498
wutzebaer Avatar asked Nov 13 '22 01:11

wutzebaer


1 Answers

if you are implementing your API behind an interface, so all your interfaces might inherit from one interface let us name is "BaseAPI" and logically if you set @Gzip on the BaseAPI so it would apply Content-Encoding for all inherited interfaces and method.

@GZIP
public interface BaseAPI
{
}


public interface APIX extends BaseAPI
{
   @GET
   Response getSomething() {
}
like image 64
mgalala Avatar answered Jan 04 '23 01:01

mgalala