public HttpRequestBase getHttpRequest ( HttpServletRequest req , String urlString ) { // Prepare a request object HttpRequestBase httpget = null ; String method = req . getMethod ( ) ; if ( GET . equalsIgnoreCase ( method ) ) httpget = new HttpGet ( urlString ) ; else if ( POST . equalsIgnoreCase ( method ) ) httpget = new HttpPost ( urlString ) ; else if ( PUT . equalsIgnoreCase ( method ) ) httpget = new HttpPut ( urlString ) ; else if ( DELETE . equalsIgnoreCase ( method ) ) httpget = new HttpDelete ( urlString ) ; else if ( HEAD . equalsIgnoreCase ( method ) ) httpget = new HttpHead ( urlString ) ; else if ( OPTIONS . equalsIgnoreCase ( method ) ) httpget = new HttpOptions ( urlString ) ; else if ( TRACE . equalsIgnoreCase ( method ) ) httpget = new HttpTrace ( urlString ) ; return httpget ; }
Get the correct client type for this request .