/** * Set the host portion of the location (ex. google.com). You can also specify * the port in this method (ex. localhost:8888). * * @param host the host */ public UrlBuilder setHost(String host) { // Extract the port from the host. if (host != null && host.contains(":")) { String[] parts = host.split(":"); if (parts.length > 2) { throw new IllegalArgumentException( "Host contains more than one colon: " + host); } try { setPort(Integer.parseInt(parts[1])); } catch (NumberFormatException e) { throw new IllegalArgumentException("Could not parse port out of host: " + host); } host = parts[0]; } this.host = host; return this; }
builder.setPort(Integer.parseInt(port));
@Override public IsUrlBuilder setPort(int port) { b.setPort(port); return this; }
/** * Set the host portion of the location (ex. google.com). You can also specify * the port in this method (ex. localhost:8888). * * @param host the host */ public UrlBuilder setHost(String host) { // Extract the port from the host. if (host != null && host.contains(":")) { String[] parts = host.split(":"); if (parts.length > 2) { throw new IllegalArgumentException( "Host contains more than one colon: " + host); } try { setPort(Integer.parseInt(parts[1])); } catch (NumberFormatException e) { throw new IllegalArgumentException("Could not parse port out of host: " + host); } host = parts[0]; } this.host = host; return this; }
/** * Set the host portion of the location (ex. google.com). You can also specify * the port in this method (ex. localhost:8888). * * @param host the host */ public UrlBuilder setHost(String host) { // Extract the port from the host. if (host != null && host.contains(":")) { String[] parts = host.split(":"); if (parts.length > 2) { throw new IllegalArgumentException( "Host contains more than one colon: " + host); } try { setPort(Integer.parseInt(parts[1])); } catch (NumberFormatException e) { throw new IllegalArgumentException("Could not parse port out of host: " + host); } host = parts[0]; } this.host = host; return this; }
builder.setPort(Integer.parseInt(port));
builder.setPort(Integer.parseInt(port));