commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsde...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HostConfiguration.java HttpClient.java SimpleHttpConnectionManager.java URI.java
Date Tue, 17 Dec 2002 01:36:42 GMT
jsdever     2002/12/16 17:36:42

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HostConfiguration.java HttpClient.java
                        SimpleHttpConnectionManager.java URI.java
  Log:
  Added some convenience to some classes:
  
  - URI can be constructed from URL now
  - HostConfiguration.setHost(URI) sets protocol, host, port from URI
  
  Contributed by: Ortwin Gluck
  
  Revision  Changes    Path
  1.4       +16 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HostConfiguration.java
  
  Index: HostConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HostConfiguration.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HostConfiguration.java	16 Dec 2002 03:51:03 -0000	1.3
  +++ HostConfiguration.java	17 Dec 2002 01:36:41 -0000	1.4
  @@ -205,11 +205,23 @@
           }
           
           this.host = host;
  -        this.port = port;
  +        this.port = port == -1 ? protocol.getDefaultPort() : port;
           this.protocol = protocol;
           
           this.hostSet = true;
           
  +    }
  +
  +    /**
  +     * Sets the protocol, host and port from the given URI.
  +     * @param uri the URI.
  +     */
  +    public synchronized void setHost(URI uri) {
  +        try {
  +            setHost(uri.getHost(), uri.getPort(), uri.getScheme());
  +        } catch(URIException e) {
  +            throw new IllegalArgumentException(e.toString());
  +        }
       }
   
       public synchronized String getHostURL() {
  
  
  
  1.64      +5 -5      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- HttpClient.java	16 Dec 2002 03:51:03 -0000	1.63
  +++ HttpClient.java	17 Dec 2002 01:36:41 -0000	1.64
  @@ -515,7 +515,7 @@
           HostConfiguration methodConfiguration = new HostConfiguration(hostConfiguration);
           
           if ( hostConfiguration != defaultHostConfiguration ) {
  -            // we may need to appy some defaults
  +            // we may need to apply some defaults
               if ( !methodConfiguration.isHostSet() ) {
                   methodConfiguration.setHost(
                       defaultHostConfiguration.getHost(),
  
  
  
  1.4       +4 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java
  
  Index: SimpleHttpConnectionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleHttpConnectionManager.java	16 Dec 2002 03:51:04 -0000	1.3
  +++ SimpleHttpConnectionManager.java	17 Dec 2002 01:36:41 -0000	1.4
  @@ -172,7 +172,7 @@
                   lastResponse.close();
               }
               catch (IOException ioe) {
  -                // badness - close to force reconnect.
  +                //FIXME: badness - close to force reconnect.
                   conn.close();
               }
           }
  
  
  
  1.15      +16 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java
  
  Index: URI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- URI.java	3 Nov 2002 17:15:05 -0000	1.14
  +++ URI.java	17 Dec 2002 01:36:41 -0000	1.15
  @@ -69,6 +69,7 @@
   import java.util.Locale;
   import java.util.BitSet;
   import java.util.Hashtable;
  +import java.net.URL;
   import java.security.AccessController;
   import java.security.PrivilegedAction;
   import sun.security.action.GetBooleanAction;
  @@ -182,6 +183,17 @@
        */
       public URI(String original) throws URIException {
           parseUriReference(original, false);
  +    }
  +
  +    /**
  +     * Construct a URI from a URL.
  +     *
  +     * @param url a valid URL.
  +     * @throws URIException
  +     * @since 2.0 
  +     */
  +    public URI(URL url) throws URIException {
  +        this(url.toString());
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message