views:

37

answers:

0

How to add client filter to dispatch in jersey? I want to add gzip filter. I create dispatch object and invoke WS this way.

   Service svc = Service.create(qname);
   svc.addPort(qname, HTTPBinding.HTTP_BINDING, server + uri);
   Dispatch<Object> dispatcher = svc.createDispatch(qname, jaxbContext, 
                                                  Service.Mode.PAYLOAD);
   requestCtx.put(MessageContext.HTTP_REQUEST_METHOD, method);
   Response r = (Response) dispatcher.invoke(o);