@Test public void testSetCompression_false() { Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>(); List<String> contentEncoding = new LinkedList<String>(); contentEncoding.add("gzip"); httpHeaders.put("Content-Encoding", contentEncoding); when(mockSoapClient.getRequestContext()).thenReturn(mockRequestContext); when(mockRequestContext.get(MessageContext.HTTP_REQUEST_HEADERS)) .thenReturn(httpHeaders); jaxWsHandler.setCompression(mockSoapClient, false); assertEquals(null, httpHeaders.get("Accept-Encoding")); assertEquals(null, httpHeaders.get("Content-Encoding")); }
@Override public void setCompression(BindingProvider soapClient, boolean compress) { Map<String, String> headersMap = Maps.newHashMap(); if (compress) { headersMap.put("Accept-Encoding", "gzip"); headersMap.put("Content-Encoding", "gzip"); putAllHttpHeaders(soapClient, headersMap); } else { @SuppressWarnings("unchecked") Map<String, List<String>> httpHeaders = (Map<String, List<String>>) soapClient.getRequestContext().get( MessageContext.HTTP_REQUEST_HEADERS); if (httpHeaders != null) { httpHeaders.remove("Accept-Encoding"); httpHeaders.remove("Content-Encoding"); } } }
JaxWsHandler extends SoapClientHandler<BindingProvider> { @Override public void setCompression(BindingProvider soapClient, boolean compress) { Map<String, String> headersMap = Maps.newHashMap(); if (compress) { headersMap.put("Accept-Encoding", "gzip"); headersMap.put("Content-Encoding", "gzip"); putAllHttpHeaders(soapClient, headersMap); } else { @SuppressWarnings("unchecked") Map<String, List<String>> httpHeaders = (Map<String, List<String>>) soapClient.getRequestContext().get( MessageContext.HTTP_REQUEST_HEADERS); if (httpHeaders != null) { httpHeaders.remove("Accept-Encoding"); httpHeaders.remove("Content-Encoding"); } } } }
JaxWsHandler extends SoapClientHandler<BindingProvider> { @Override public void setCompression(BindingProvider soapClient, boolean compress) { Map<String, String> headersMap = Maps.newHashMap(); if (compress) { headersMap.put("Accept-Encoding", "gzip"); headersMap.put("Content-Encoding", "gzip"); putAllHttpHeaders(soapClient, headersMap); } else { @SuppressWarnings("unchecked") Map<String, List<String>> httpHeaders = (Map<String, List<String>>) soapClient.getRequestContext().get( MessageContext.HTTP_REQUEST_HEADERS); if (httpHeaders != null) { httpHeaders.remove("Accept-Encoding"); httpHeaders.remove("Content-Encoding"); } } } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); }
JaxWsHandler extends SoapClientHandler<BindingProvider> { @Override public void setCompression(BindingProvider soapClient, boolean compress) { Map<String, String> headersMap = Maps.newHashMap(); if (compress) { headersMap.put("Accept-Encoding", "gzip"); headersMap.put("Content-Encoding", "gzip"); putAllHttpHeaders(soapClient, headersMap); } else { @SuppressWarnings("unchecked") Map<String, List<String>> httpHeaders = (Map<String, List<String>>) soapClient.getRequestContext().get( MessageContext.HTTP_REQUEST_HEADERS); if (httpHeaders != null) { httpHeaders.remove("Accept-Encoding"); httpHeaders.remove("Content-Encoding"); } } } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); @Override void setEndpointAddress(BindingProvider soapClient, String endpointAddress); @Override Object getHeader(BindingProvider soapClient, String headerName); @Override void clearHeaders(BindingProvider soapClient); @Override void setHeader(BindingProvider soapClient, String namespace, String headerName,
      Object headerValue); void setHeaderChildString(BindingProvider soapClient, final String headerName,
      String childNamespace, String childName, String childValue); @Override void putAllHttpHeaders(BindingProvider soapClient, Map<String, String> headersMap); @Override void setCompression(BindingProvider soapClient, boolean compress); @Override BindingProvider createSoapClient(SoapServiceDescriptor soapServiceDescriptor); @Override void setRequestTimeout(BindingProvider bindingProvider, int timeout); @Override RemoteCallReturn invokeSoapCall(SoapCall<BindingProvider> soapCall); @Override String getEndpointAddress(BindingProvider soapClient); @Override SOAPHeaderElement createSoapHeaderElement(QName qName); }
JaxWsHandler extends SoapClientHandler<BindingProvider> { @Override public void setCompression(BindingProvider soapClient, boolean compress) { Map<String, String> headersMap = Maps.newHashMap(); if (compress) { headersMap.put("Accept-Encoding", "gzip"); headersMap.put("Content-Encoding", "gzip"); putAllHttpHeaders(soapClient, headersMap); } else { @SuppressWarnings("unchecked") Map<String, List<String>> httpHeaders = (Map<String, List<String>>) soapClient.getRequestContext().get( MessageContext.HTTP_REQUEST_HEADERS); if (httpHeaders != null) { httpHeaders.remove("Accept-Encoding"); httpHeaders.remove("Content-Encoding"); } } } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); @Override void setEndpointAddress(BindingProvider soapClient, String endpointAddress); @Override Object getHeader(BindingProvider soapClient, String headerName); @Override void clearHeaders(BindingProvider soapClient); @Override void setHeader(BindingProvider soapClient, String namespace, String headerName,
      Object headerValue); void setHeaderChildString(BindingProvider soapClient, final String headerName,
      String childNamespace, String childName, String childValue); @Override void putAllHttpHeaders(BindingProvider soapClient, Map<String, String> headersMap); @Override void setCompression(BindingProvider soapClient, boolean compress); @Override BindingProvider createSoapClient(SoapServiceDescriptor soapServiceDescriptor); @Override void setRequestTimeout(BindingProvider bindingProvider, int timeout); @Override RemoteCallReturn invokeSoapCall(SoapCall<BindingProvider> soapCall); @Override String getEndpointAddress(BindingProvider soapClient); @Override SOAPHeaderElement createSoapHeaderElement(QName qName);  }