Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4941958

HttpURLConnection per instance Authenticator

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2, 6u23
    • core-libs

      Name: rmT116609 Date: 10/22/2003


      A DESCRIPTION OF THE REQUEST :
      Currently, a JVM cam have at most one 'live' Authenticator object at any
      given time; i.e. the one set using Authenticator.setDefault(). This causes
      problems in some applications. I propose that a new method be added to
      the URLConnection API:

          void setAuthenticator(java.net.Authenticator auth)
             throws InvalidStateException;

      This method would allow an application to bind a specific Authenticator
      to an unconnected URLConnection object to be used instead of the JVM-wide
      default Authenticator.

      JUSTIFICATION :
      This method will make it possible to do a number of things that are otherwise
      hard to implement in a multi-threaded application. For example, if a URL has
      a 'userinfo' componenent, the application can create a once-off Authenticator
      for the URL's username and password and attach it to the URLConnection. It does not need to worrying about interfering with (or leaking passwords to) other
      threads.
      (Incident Review ID: 216097)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: