I don't know about CXF 2.3.2 (that's a rather old version), but here are
my notes from October 2012:
http://www.jroller.com/gmazza/entry/compressing_soap_messages
HTH,
Glen
On 02/13/2013 11:39 AM, Alex wrote:
I am using CXF 2.3.2 and I use Soap Handlers to transmit messages. I am
trying to set/request gZip in HTTP REQUEST HEADERS inside my Java CXF WS
Client BUT for some reason its being IGNORED. I don't see gzip being passed
in HTTP REQUEST HEADER and that's why I don't get back gZipped response.
Here is how I am trying to set. What am I missing?
public class LoggerXML implements SOAPHandler<SOAPMessageContext> {
private String uniqueIdentifier;
private String sessionId;
public LoggerXML(String sessionId, String uniqueIdentifier) {
this.sessionId = sessionId;
this.uniqueIdentifier = uniqueIdentifier;
}
protected final void setLogStream(PrintStream ps) {
// out = ps;
}
public void init(Map c) {
uniqueIdentifier = "";
}
public Set<QName> getHeaders() {
return null;
}
public boolean handleMessage(SOAPMessageContext smc) {
Boolean outboundProperty = (Boolean)
smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if(outboundProperty){
// Creating HTTP headers & setting gZip.
Map<String, List<String>> headers = (Map<String,
List<String>>)
smc.get(MessageContext.HTTP_REQUEST_HEADERS);
if(headers == null){
//System.out.println("LoggerXML.handleMessage: headers =
null");
headers = new HashMap<String, List<String>>();
}
// Add HTTP headers to the web service request
headers.put("Accept-Encoding",
Collections.singletonList("gzip,deflate"));
//headers.put("Content-Encoding",
Collections.singletonList("gzip"));
//headers.put("Accept-Encoding",
Collections.singletonList("gzip"));
smc.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
//smc.put("org.apache.cxf.transport.common.gzip.GZIPOutInterceptor.UseGzip","YES");
}
return true;
}
public boolean handleFault(SOAPMessageContext smc) {
return true;
}
// nothing to clean up
public void close(MessageContext messageContext) {
}
// nothing to clean up
public void destroy() {
}
// Other Methods....
}
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-2-3-2-and-gZip-Issues-tp5723119.html
Sent from the cxf-user mailing list archive at Nabble.com.