title: setDefaultAuthenticator causes a java.security.AccessControlException in GWT web application
body: <p>I am creating a web application using GWT, the server provides a service to the client. In this service, it must generate an HTTP request to another server with authentication. The following code describes how to make the request:</p>
  
  <pre><code>public int request()
  {
      Authenticator.setDefault(new MyAuthenticator(username, password));
      try {
          URL url = new URL(url_string);
          URLConnection conn = url.openConnection();
          conn.setRequestProperty("Content-Type", "text/xml");
          conn.setDoOutput(true);
          OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
          wr.write(buildRequest());
          wr.flush();
          BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
          //the rest is to handle the response ...
  
      } catch (Exception e) {
          //handle exception
      }
  }
  </code></pre>
  
  <p><code>MyAuthenticator</code> is implemented as suggested <a href="http://www.exampledepot.com/egs/java.net/Auth.html" rel="nofollow">here</a>, I tested the code and it works like a charm, but when I try to incorporate it in GWT project, I am getting an exception:</p>
  
  <pre><code>//huge stack trace above ... what is important is the following
  Caused by: java.security.AccessControlException: access denied (java.net.NetPermission setDefaultAuthenticator)
  </code></pre>
  
  <p>Any ideas how to solve this?</p>