case GET: httpMethod = new GetMethod(uri); break;
case POST: httpMethod = getMethod(new PostMethod(uri), entity); break;
case PUT: httpMethod = getMethod(new PutMethod(uri), entity); break;
case DELETE: httpMethod = new DeleteMethod(uri); break;
case HEAD: httpMethod = new HeadMethod(uri); break;
case OPTIONS: httpMethod = new OptionsMethod(uri); break;
case TRACE: httpMethod = new TraceMethod(uri); break;
default: httpMethod = getMethod(new ExtensionMethod(method,uri), entity);
}
if (actual != null) {
httpMethod.addRequestHeader("X-HTTP-Method-Override", actual.name());