httpclient.addRequestInterceptor(new PreemptiveAuth(), 0);
httpContext = localcontext;
}
}
AbstractHttpMessage method = null;
final HTTPMethod httpMethod = request.getMethod();
try {
switch(httpMethod){
case GET:
method = new HttpGet(urlStr);
break;
case POST:
method = new HttpPost(urlStr);
break;
case PUT:
method = new HttpPut(urlStr);
break;
case DELETE:
method = new HttpDelete(urlStr);
break;
case HEAD:
method = new HttpHead(urlStr);
break;
case OPTIONS:
method = new HttpOptions(urlStr);
break;
case TRACE:
method = new HttpTrace(urlStr);
break;
}
method.setParams(new BasicHttpParams().setParameter(urlStr, url));
// Get request headers
MultiValueMap<String, String> header_data = request.getHeaders();
for (String key : header_data.keySet()) {
for(String value: header_data.get(key)) {
Header header = new BasicHeader(key, value);
method.addHeader(header);
}
}
// POST/PUT method specific logic
if (method instanceof HttpEntityEnclosingRequest) {