Message reqMessage = msgContext.getRequestMessage();
if(posting) {
method = new PostMethod(targetURL.toString());
addContextInfo(method, httpClient, msgContext, targetURL);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
reqMessage.writeTo(baos);
((PostMethod)method).setRequestBody(new ByteArrayInputStream(baos.toByteArray()));
((PostMethod)method).setUseExpectHeader(false); // workaround for
} else {
method = new GetMethod(targetURL.toString());
addContextInfo(method, httpClient, msgContext, targetURL);