In javadoc there is no clear way on how to download page that requires Basic Authentication, for example like:
Fortunately, this is still very possible and not too complicated, just add this somewhere before calling URL:
Possibly it would be better to have login and password as parameters, but this still works.
  def result = new URL("http://www.requireslogin.com/").getText()
Fortunately, this is still very possible and not too complicated, just add this somewhere before calling URL:
  java.net.Authenticator.setDefault(new java.net.Authenticator() {
    protected java.net.PasswordAuthentication getPasswordAuthentication() {
      return new java.net.PasswordAuthentication("user", "password".toCharArray());
    }
  });
Possibly it would be better to have login and password as parameters, but this still works.
