protected static String generateRequestLine(HttpConnection connection,
        String name, String requestPath, String query, String version) {
        LOG.trace("enter HttpMethodBase.generateRequestLine(HttpConnection, "
            + "String, String, String, String)");

        StringBuffer buf = new StringBuffer();
        // Append method name
        buf.append(name);
        buf.append(" ");
        // Absolute or relative URL?
        if (!connection.isTransparent()) {
            Protocol protocol = connection.getProtocol();
            buf.append(protocol.getScheme().toLowerCase(Locale.ENGLISH));
            buf.append("://");
            buf.append(connection.getHost());
            if ((connection.getPort() != -1) 
                && (connection.getPort() != protocol.getDefaultPort())
            ) {
                buf.append(":");
                buf.append(connection.getPort());
            }
        }
        // Append path, if any
        if (requestPath == null) {
            buf.append("/");
        } else {
            if (!connection.isTransparent() && !requestPath.startsWith("/")) {
                buf.append("/");
            }
            buf.append(requestPath);
        }
        // Append query, if any
        if (query != null) {
            // ZAP: If commented out to not change the intended request URI (i.e. if the query component starts with a "?" char)
            //if (query.indexOf("?") != 0) {
                buf.append("?");
            //}
            buf.append(query);
        }
        // Append protocol
        buf.append(" ");
        buf.append(version);
        buf.append("\r\n");
        
        return buf.toString();
    }
protected static String generateRequestLine ( HttpConnection connection , String name , String requestPath , String query , String version ) { LOG . trace ( "enter HttpMethodBase.generateRequestLine(HttpConnection, " + "String, String, String, String)" ) ; StringBuffer buf = new StringBuffer ( ) ; buf . append ( name ) ; buf . append ( " " ) ; if ( ! connection . isTransparent ( ) ) { Protocol protocol = connection . getProtocol ( ) ; buf . append ( protocol . getScheme ( ) . toLowerCase ( Locale . ENGLISH ) ) ; buf . append ( "://" ) ; buf . append ( connection . getHost ( ) ) ; if ( ( connection . getPort ( ) != - 1 ) && ( connection . getPort ( ) != protocol . getDefaultPort ( ) ) ) { buf . append ( ":" ) ; buf . append ( connection . getPort ( ) ) ; } } if ( requestPath == null ) { buf . append ( "/" ) ; } else { if ( ! connection . isTransparent ( ) && ! requestPath . startsWith ( "/" ) ) { buf . append ( "/" ) ; } buf . append ( requestPath ) ; } if ( query != null ) { buf . append ( "?" ) ; buf . append ( query ) ; } buf . append ( " " ) ; buf . append ( version ) ; buf . append ( "\r\n" ) ; return buf . toString ( ) ; }
Generates HTTP request line according to the specified attributes.

@param connection the {@link HttpConnection connection} used to execute
this HTTP method
@param name the method name generate a request for
@param requestPath the path string for the request
@param query the query string for the request
@param version the protocol version to use (e.g. HTTP/1.0)

@return HTTP request line