Hi ,i'm trying to send a Http Request to a reverse proxy (nginx) , then the
proxy responds with a HTTP error 411 ( length required).
I read CXF documentation that says that some older proxies have problems with
Chunking.
I disable chunking using CXF but the header content-length is not present in my
HTTP Request Header.
i tried two ways for solve this problem.
1) this way does not work
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
2) write a custom Interceptor
Public CustomInterceptor extends AbstractPhaseInterceptor<Message>{
public CustomInterceptor(){
super(Phase.WRITE);
}
@override
public void handleMessage(Message message) throws Fault{
Map<String,List<String>>
headers=(Map<String,List<String>>)message.getContextualProperty(Message.PROTOCOL_HEADERS);
headers.put(HttpHeaderHelper.CONTENT_LENGTH,Arryas.asList(sizeOfMyMessageInBytes));
}
}
with this code i set the Content-Length header in my HTTP Request message, but
i can't determine the length of my message in bytes. how can i solve it ?
Is there another way to solve this issue(HTTP Header content-Length)?
thanks in advance .
Eduardo.