public String toHttpString ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( getHttpVerb ( ) ) . append ( ' ' ) . append ( getHttpURI ( ) ) . append ( ' ' ) . append ( getHttpVersion ( ) ) . append ( HttpProxyConstants . CRLF ) ; boolean hostHeaderFound = false ; if ( getHeaders ( ) != null ) { for ( Map . Entry < String , List < String > > header : getHeaders ( ) . entrySet ( ) ) { if ( ! hostHeaderFound ) { hostHeaderFound = header . getKey ( ) . equalsIgnoreCase ( "host" ) ; } for ( String value : header . getValue ( ) ) { sb . append ( header . getKey ( ) ) . append ( ": " ) . append ( value ) . append ( HttpProxyConstants . CRLF ) ; } } if ( ! hostHeaderFound && getHttpVersion ( ) == HttpProxyConstants . HTTP_1_1 ) { sb . append ( "Host: " ) . append ( getHost ( ) ) . append ( HttpProxyConstants . CRLF ) ; } } sb . append ( HttpProxyConstants . CRLF ) ; return sb . toString ( ) ; }
Returns the string representation of the HTTP request .