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

bind proxy Authenticator to URLConnection

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE REQUEST :
      Now, we use the code below to use proxy in URLConnection. But the Authenticator is JVM global, not bind to a specific URLConnection. But actually we need to access different proxy(with different Authenticator) in applications.

      Authenticator.setDefault(
         new Authenticator() {
            public PasswordAuthentication getPasswordAuthentication() {
               return new PasswordAuthentication(
                     authUser, authPassword.toCharArray());
            }
         }
      );

      Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.1", 8080));
      conn = new URL(urlString).openConnection(proxy);

      JUSTIFICATION :
      the concept of model of proxy Authenticator is built not correctly.


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dfuchs Daniel Fuchs
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: