{
httpRequest = new HttpGet(proxyTargetURL);
}
else if (HttpHead.METHOD_NAME.equals(method))
{
httpRequest = new HttpHead(proxyTargetURL);
}
else if (HttpPost.METHOD_NAME.equals(method))
{
httpRequest = new HttpPost(proxyTargetURL);
long contentLength = NumberUtils.toLong(request.getHeader(HTTP.CONTENT_LEN));
if (contentLength > 0L)
{
HttpEntity entity = new InputStreamEntity(request.getInputStream(), contentLength);
((HttpPost) httpRequest).setEntity(entity);
}
}
else if (HttpPut.METHOD_NAME.equals(method))
{
httpRequest = new HttpPut(proxyTargetURL);
long contentLength = NumberUtils.toLong(request.getHeader(HTTP.CONTENT_LEN));
if (contentLength > 0L)
{
HttpEntity entity = new InputStreamEntity(request.getInputStream(), contentLength);
((HttpPost) httpRequest).setEntity(entity);
}
}
else if (HttpDelete.METHOD_NAME.equals(method))
{
httpRequest = new HttpDelete(proxyTargetURL);
}
else if (HttpOptions.METHOD_NAME.equals(method))
{
httpRequest = new HttpOptions(proxyTargetURL);
}
else if (HttpTrace.METHOD_NAME.equals(method))
{
httpRequest = new HttpHead(proxyTargetURL);
}
else
{
throw new HttpReverseProxyException("Unsupported method: " + method);
}