adasilva    2002/11/01 13:57:26

  Modified:    java/src/org/apache/wsil WSILDocument.java
  Log:
  Add code to handle Authenticating Proxies.
  
  Revision  Changes    Path
  1.3       +26 -5     xml-axis-wsil/java/src/org/apache/wsil/WSILDocument.java
  
  Index: WSILDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsil/java/src/org/apache/wsil/WSILDocument.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WSILDocument.java 16 Oct 2002 18:20:14 -0000      1.2
  +++ WSILDocument.java 1 Nov 2002 21:57:26 -0000       1.3
  @@ -300,23 +300,44 @@
     {
       try
       {
  +      InputStream is;
  +
         // Save the URL passed
         documentURL = url.toString();
   
  -      // Open input stream
  -      InputStream is = (InputStream) url.openStream();
  -            
  +      // Get proxy userName and password
  +      String proxyUserName = System.getProperty("http.proxyUserName");
  +      String proxyPassword = System.getProperty("http.proxyPassword");
  +
  +      if (proxyUserName != null && proxyPassword != null)
  +      {
  +        // Handle authenticating proxies
  +        String userPassword = proxyUserName + ":" + proxyPassword;
  +
  +        // Encode userid and password
  +        String encoding = Base64Converter.encode(userPassword);
  +
  +        // Open connection and set encoding property
  +        URLConnection uc = url.openConnection();
  +        uc.setRequestProperty("Proxy-authorization", "Basic " + encoding);
  +
  +        // Get input stream
  +        is = uc.getInputStream();
  +      }
  +      else 
  +        // Open input stream
  +        is = (InputStream) url.openStream();
  +      
         // Read the WS-Inspection document
         read(new InputStreamReader(is));
       }
  -    
       catch (Exception e)
       {
          // Throw exception
          throw new WSILException("Could not read WS-Inspection document from: " + 
url.toString(), e);
       }
     }
  -  
  +
     
     /**
      * Set the WS-Inspection extension registry implementation.
  
  
  


Reply via email to