/** * {@inheritDoc} */ public URLConnection createConnection(URL url) throws IOException { if (url == null) { throw new IllegalArgumentException("URL cannot be null!"); } URLConnection conn = url.openConnection(); UrlCredentials creds = getCredentials(url); if (creds != null) { supplyCredentials(conn, creds); } return conn; }
/** * {@inheritDoc} */ public URLConnection createConnection(URL url, User user) throws IOException { if (url == null) { throw new IllegalArgumentException("URL cannot be null!"); } if (user == null) { throw new IllegalArgumentException("User cannot be null!"); } URLConnection conn = url.openConnection(); UrlCredentials creds = getCredentials(url); if (creds != null) { // TODO apply user! supplyCredentials(conn, creds); } return conn; }