@ClientInterceptor @Provider public class RESTClientExecutionInterceptor implements ClientExecutionInterceptor {
@ClientInterceptor @Provider public class RESTClientExecutionInterceptor implements ClientExecutionInterceptor {
/** * Client interceptor to set HTTP headers to advertise that REST client can accept LZF encoding */ @Provider @ClientInterceptor @HeaderDecoratorPrecedence public class AcceptLZFClientInterceptor { /** * Set headers to advertise ability to accept LZF compression <p/> * Check if client response has HTTP header "Accept-Encoding" set: <p/> * <ul> <li>- If none, set header to "lzf", if has a header, add lzf to the list</li></ul> * @param ctx Client execution context * @return Response with headers appended * @throws Exception */ public ClientResponse execute(ClientExecutionContext ctx) throws Exception { String encoding = ctx.getRequest().getHeaders().getFirst(HttpHeaders.ACCEPT_ENCODING); if (encoding == null) { ctx.getRequest().header(HttpHeaders.ACCEPT_ENCODING, "lzf"); } else { if (!encoding.contains("lzf")) { encoding += ", lzf"; ctx.getRequest().header(HttpHeaders.ACCEPT_ENCODING, encoding); } } return ctx.proceed(); } }
@ClientInterceptor @HeaderDecoratorPrecedence @Deprecated
@ClientInterceptor @HeaderDecoratorPrecedence public class AcceptEncodingGZIPInterceptor implements ClientExecutionInterceptor
@ClientInterceptor @DecoderPrecedence public class LZFDecodingInterceptor implements MessageBodyReaderInterceptor {
@ClientInterceptor @EncoderPrecedence public class LZFEncodingInterceptor implements MessageBodyWriterInterceptor