Brams
Brams

Reputation: 309

JAX-WS RS with Apache CXF - GZIP Compression

I'm creating a RESTFul WS using JAX-RS with Apache CXF. I want to be able to compress the data being returned. An example of my code is:

 @POST  
 @Path("testGZIPMethod")
 @GZIP
 @Produces(MediaType.APPLICATION_JSON)  
 public String testGZIPMethod(@FormParam("userinput")String userinput)  
 {
     //return JSON String
 }

When i try to compile my class using JDev, i get the following error: annotation type not applicable to this kind of declaration. The annotation causing this error is @GZIP. Any idea where to move on from here?

Upvotes: 1

Views: 1220

Answers (1)

xwoker
xwoker

Reputation: 3171

The @GZIP annotation can only be applied to types and not to methods:

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface GZIP {
    int threshold() default -1;
}

Upvotes: 1

Related Questions