public URLName(URL url) { protocol = checkBlank(url.getProtocol()); host = checkBlank(url.getHost()); port = url.getPort(); file = checkBlank(url.getFile()); ref = checkBlank(url.getRef()); String userInfo = checkBlank(url.getUserInfo()); if (userInfo == null) { username = null; password = null; } else { int pos = userInfo.indexOf(':'); if (pos == -1) { username = userInfo; password = null; } else { username = userInfo.substring(0, pos); password = userInfo.substring(pos + 1); } } updateFullURL(); }
public URLName(URL url) { protocol = checkBlank(url.getProtocol()); host = checkBlank(url.getHost()); port = url.getPort(); file = checkBlank(url.getFile()); ref = checkBlank(url.getRef()); String userInfo = checkBlank(url.getUserInfo()); if (userInfo == null) { username = null; password = null; } else { int pos = userInfo.indexOf(':'); if (pos == -1) { username = userInfo; password = null; } else { username = userInfo.substring(0, pos); password = userInfo.substring(pos + 1); } } updateFullURL(); }
public URLName(String protocol, String host, int port, String file, String username, String password) { this.protocol = checkBlank(protocol); this.host = checkBlank(host); this.port = port; if (file == null || file.length() == 0) { this.file = null; ref = null; } else { int pos = file.indexOf('#'); if (pos == -1) { this.file = file; ref = null; } else { this.file = file.substring(0, pos); ref = file.substring(pos + 1); } } this.username = checkBlank(username); if (this.username != null) { this.password = checkBlank(password); } else { this.password = null; } updateFullURL(); }
public URLName(String protocol, String host, int port, String file, String username, String password) { this.protocol = checkBlank(protocol); this.host = checkBlank(host); this.port = port; if (file == null || file.length() == 0) { this.file = null; ref = null; } else { int pos = file.indexOf('#'); if (pos == -1) { this.file = file; ref = null; } else { this.file = file.substring(0, pos); ref = file.substring(pos + 1); } } this.username = checkBlank(username); if (this.username != null) { this.password = checkBlank(password); } else { this.password = null; } username = encode(username); password = encode(password); updateFullURL(); }