public HttpRequest set(String destination) {
		destination = destination.trim();

		// http method, optional

		int ndx = destination.indexOf(' ');

		if (ndx != -1) {
			String method = destination.substring(0, ndx).toUpperCase();

			try {
				HttpMethod httpMethod = HttpMethod.valueOf(method);
				this.method = httpMethod.name();
				destination = destination.substring(ndx + 1);
			}
			catch (IllegalArgumentException ignore) {
				// unknown http method
			}
		}

		// protocol

		ndx = destination.indexOf("://");

		if (ndx != -1) {
			protocol = destination.substring(0, ndx);
			destination = destination.substring(ndx + 3);
		}

		// host

		ndx = destination.indexOf('/');

		if (ndx == -1) {
			ndx = destination.length();
		}

		if (ndx != 0) {

			String hostToSet = destination.substring(0, ndx);
			destination = destination.substring(ndx);

			// port

			ndx = hostToSet.indexOf(':');

			if (ndx == -1) {
				port = Defaults.DEFAULT_PORT;
			} else {
				port = Integer.parseInt(hostToSet.substring(ndx + 1));
				hostToSet = hostToSet.substring(0, ndx);
			}

			host(hostToSet);
		}

		// path + query

		path(destination);

		return this;
	}
public HttpRequest set(String destination) {
		destination = destination.trim();

		

		int ndx = destination.indexOf(' ');

		if (ndx != -1) {
			String method = destination.substring(0, ndx).toUpperCase();

			try {
				HttpMethod httpMethod = HttpMethod.valueOf(method);
				this.method = httpMethod.name();
				destination = destination.substring(ndx + 1);
			}
			catch (IllegalArgumentException ignore) {
				
			}
		}

		

		ndx = destination.indexOf(":

		if (ndx != -1) {
			protocol = destination.substring(0, ndx);
			destination = destination.substring(ndx + 3);
		}

		

		ndx = destination.indexOf('/');

		if (ndx == -1) {
			ndx = destination.length();
		}

		if (ndx != 0) {

			String hostToSet = destination.substring(0, ndx);
			destination = destination.substring(ndx);

			

			ndx = hostToSet.indexOf(':');

			if (ndx == -1) {
				port = Defaults.DEFAULT_PORT;
			} else {
				port = Integer.parseInt(hostToSet.substring(ndx + 1));
				hostToSet = hostToSet.substring(0, ndx);
			}

			host(hostToSet);
		}

		

		path(destination);

		return this;
	}
public HttpRequest set ( String destination ) { destination = destination . trim ( ) ; // http method, optional int ndx = destination . indexOf ( ' ' ) ; if ( ndx != - 1 ) { String method = destination . substring ( 0 , ndx ) . toUpperCase ( ) ; try { HttpMethod httpMethod = HttpMethod . valueOf ( method ) ; this . method = httpMethod . name ( ) ; destination = destination . substring ( ndx + 1 ) ; } catch ( IllegalArgumentException ignore ) { // unknown http method } } // protocol ndx = destination . indexOf ( "://" ) ; if ( ndx != - 1 ) { protocol = destination . substring ( 0 , ndx ) ; destination = destination . substring ( ndx + 3 ) ; } // host ndx = destination . indexOf ( ' ' ) ; if ( ndx == - 1 ) { ndx = destination . length ( ) ; } if ( ndx != 0 ) { String hostToSet = destination . substring ( 0 , ndx ) ; destination = destination . substring ( ndx ) ; // port ndx = hostToSet . indexOf ( ' ' ) ; if ( ndx == - 1 ) { port = Defaults . DEFAULT_PORT ; } else { port = Integer . parseInt ( hostToSet . substring ( ndx + 1 ) ) ; hostToSet = hostToSet . substring ( 0 , ndx ) ; } host ( hostToSet ) ; } // path + query path ( destination ) ; return this ; }
Sets the destination (method, host, port... ) at once.
Sets the destination ( method host port ... ) at once .