public HttpMethod createRequestMethodNew ( HttpRequestHeader header , HttpBody body ) throws URIException { HttpMethod httpMethod = null ; String method = header . getMethod ( ) ; URI uri = header . getURI ( ) ; String version = header . getVersion ( ) ; httpMethod = new GenericMethod ( method ) ; httpMethod . setURI ( uri ) ; HttpMethodParams httpParams = httpMethod . getParams ( ) ; // default to use HTTP 1.0 httpParams . setVersion ( HttpVersion . HTTP_1_0 ) ; if ( version . equalsIgnoreCase ( HttpHeader . HTTP11 ) ) { httpParams . setVersion ( HttpVersion . HTTP_1_1 ) ; } // set various headers int pos = 0 ; // ZAP: FindBugs fix - always initialise pattern Pattern pattern = patternCRLF ; String msg = header . getHeadersAsString ( ) ; if ( ( pos = msg . indexOf ( CRLF ) ) < 0 ) { if ( ( pos = msg . indexOf ( LF ) ) < 0 ) { pattern = patternLF ; } } else { pattern = patternCRLF ; } String [ ] split = pattern . split ( msg ) ; String token = null ; String name = null ; String value = null ; for ( int i = 0 ; i < split . length ; i ++ ) { token = split [ i ] ; if ( token . equals ( "" ) ) { continue ; } if ( ( pos = token . indexOf ( ":" ) ) < 0 ) { return null ; } name = token . substring ( 0 , pos ) . trim ( ) ; value = token . substring ( pos + 1 ) . trim ( ) ; httpMethod . addRequestHeader ( name , value ) ; } // set body if post method or put method if ( body != null && body . length ( ) > 0 ) { EntityEnclosingMethod generic = ( EntityEnclosingMethod ) httpMethod ; generic . setRequestEntity ( new ByteArrayRequestEntity ( body . getBytes ( ) ) ) ; } httpMethod . setFollowRedirects ( false ) ; return httpMethod ; }
Not used - all abstract using Generic method but GET cannot be used .