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

RFE: need way to set (http, ftp,...) proxies dynamically

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs
    • x86
    • linux



      Name: rmT116609 Date: 04/22/2003


      A DESCRIPTION OF THE REQUEST :
      Currently the only ways to set proxies seem to be to:
          1- use the system properties like this
            Properties props = System.getProperties();
            props.put("http.proxyHost", "proxyhostname");
            props.put("http.proxyPort", "proxyhostport");
            or through the command line
          2- there is a way with the java plug in described here
            http://java.sun.com/products/plugin/1.2/docs/proxies.html

      It would be very helpful to be able to set the proxy for each individual URLConnection object.




      JUSTIFICATION :
      Using solution 1. (properties) one can only set the proxies for all the URLConnection objects at once. So any mutlithreaded application that may need to use different proxies, or may need to use proxies for only some URL's will not be able to get the desired behavior.

      Using solution 2. (java plugin) requires having the java plugin. This helps for intranets with complex proxy setting. Here the default browser behavior is easy to duplicate. This is what is needed for client applications. But for servers that require more complex behavior, or require the behavior of the java plugin on non java plugin environments, this is not good enough.

      Essentially it seems that the above solutions for proxy settings have worked on making the default use easy to understand, and implement. But this should be akin to using the Facade pattern. They should make it simple to set behavior, that should nonetheless be available for more advanced programmers.

      I don't know the best way to do this. But it looks like some thought should go into how to make something like this work. My feeling is that this might also simplify some of the work classes that are currently in the sun.net.... packages.

      Currently for example one cannot simply write
           - a tool to test different proxies for speed
           - code that sets up some complicated proxy rules
      (Review ID: 184576)
      ======================================================================

            jccollet Jean-Christophe Collet (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: