This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI:Patch: java.net.URLConnection


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I commited the attached patch to trunk to merge java.net.URLConnection 
a bit more with classpath's version.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+kIpjWSOgCCdjSDsRApeIAJsHX5ixWVJV/SHWOp8i96G28GqQ5gCgnd4O
dWcfKK4l6wAPdAzfnvYWh3Q=
=LmPw
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1839
diff -u -r1.1839 ChangeLog
--- ChangeLog	6 Apr 2003 15:51:06 -0000	1.1839
+++ ChangeLog	6 Apr 2003 16:10:08 -0000
@@ -1,5 +1,18 @@
 2003-04-06  Michael Koch  <konqueror at gmx dot de>
 
+	* java/net/URLConnection.java:
+	Import classes directly.
+	(URLConnection): Merged class documentation with classpath.
+	(url): Moved, documentation from classpath added.
+	(doInput): Moved, documentation from classpath added.
+	(doOutput): Moved, documentation from classpath added.
+	(allowUserInteraction): Moved.
+	(useCaches): Moved, documentation from classpath added.
+	(ifModifiedSince): Moved, documentation from classpath added.
+	(connected): Moved, documentation from classpath added.
+
+2003-04-06  Michael Koch  <konqueror at gmx dot de>
+
 	* java/io/FileInputStream.java
 	(skip): Renamed some variables to match classpath, added
 	checks from classpath.
Index: java/net/URLConnection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLConnection.java,v
retrieving revision 1.15
diff -u -r1.15 URLConnection.java
--- java/net/URLConnection.java	20 Mar 2003 08:19:58 -0000	1.15
+++ java/net/URLConnection.java	6 Apr 2003 16:10:08 -0000
@@ -38,7 +38,11 @@
 
 package java.net;
 
-import java.io.*;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.security.Permission;
+import java.security.AllPermission;
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -46,31 +50,48 @@
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.security.Permission;
-import java.security.AllPermission;
 import gnu.gcj.io.MimeTypes;
 
 /**
- * @author Warren Levy <warrenl at cygnus dot com>
- * @date March 5, 1999.
- */
-
-/**
  * Written using on-line Java Platform 1.2 API Specification, as well
  * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
  * Status:  One guessContentTypeFrom... methods not implemented.
  *    getContent method assumes content type from response; see comment there.
  */
 
+/**
+ * This class models a connection that retrieves the information pointed
+ * to by a URL object.  This is typically a connection to a remote node
+ * on the network, but could be a simple disk read.
+ * <p>
+ * A URLConnection object is normally created by calling the openConnection()
+ * method of a URL object.  This method is somewhat misnamed because it does
+ * not actually open the connection.  Instead, it return an unconnected
+ * instance of this object.  The caller then has the opportunity to set
+ * various connection options prior to calling the actual connect() method.
+ * <p>
+ * After the connection has been opened, there are a number of methods in
+ * this class that access various attributes of the data, typically
+ * represented by headers sent in advance of the actual data itself.
+ * <p>
+ * Also of note are the getInputStream and getContent() methods which allow
+ * the caller to retrieve the actual data from the connection.  Note that
+ * for some types of connections, writing is also allowed.  The setDoOutput()
+ * method must be called prior to connecing in order to enable this, then
+ * the getOutputStream method called after the connection in order to
+ * obtain a stream to write the output to.
+ * <p>
+ * The getContent() method is of particular note.  This method returns an
+ * Object that encapsulates the data returned.  There is no way do determine
+ * the type of object that will be returned in advance.  This is determined
+ * by the actual content handlers as described in the description of that
+ * method.
+ *
+ * @author Aaron M. Renn <arenn at urbanophile dot com>
+ * @author Warren Levy <warrenl at cygnus dot com>
+ */
 public abstract class URLConnection
 {
-  protected URL url;
-  protected boolean doInput = true;
-  protected boolean doOutput = false;
-  protected boolean allowUserInteraction;
-  protected boolean useCaches;
-  protected long ifModifiedSince = 0L;
-  protected boolean connected = false;
   private static boolean defaultAllowUserInteraction = false;
   private static boolean defaultUseCaches = true;
   private static FileNameMap fileNameMap;  // Set by the URLConnection subclass.
@@ -81,6 +102,50 @@
   private static SimpleDateFormat dateFormat1, dateFormat2, dateFormat3;
   private static boolean dateformats_initialized = false;
 
+  /**
+   * This is the URL associated with this connection
+   */
+  protected URL url;
+
+  /**
+   * Indicates whether or not input can be read from this URL
+   */
+  protected boolean doInput = true;
+  
+  /**
+   * Indicates whether or not output can be sent to this URL
+   */
+  protected boolean doOutput = false;
+  
+  protected boolean allowUserInteraction;
+
+  /**
+   * If this flag is set, the protocol is allowed to cache data whenever
+   * it can (caching is not guaranteed). If it is not set, the protocol
+   * must a get a fresh copy of the data.
+   * <p>
+   * This field is set by the setUseCaches method and returned by the
+   * getUseCaches method.
+   *
+   * Its default value is that determined by the last invocation of
+   * setDefaultUseCaches
+   */
+  protected boolean useCaches;
+
+  /**
+   * If this value is non-zero, then the connection will only attempt to
+   * fetch the document pointed to by the URL if the document has been
+   * modified more recently than the date set in this variable.  That date
+   * should be specified as the number of seconds since 1/1/1970 GMT.
+   */
+  protected long ifModifiedSince = 0L;
+
+  /**
+   * Indicates whether or not a connection has been established to the
+   * destination specified in the URL
+   */
+  protected boolean connected = false;
+  
   /**
    * Creates a URL connection to a given URL. A real connection is not made.
    * Use #connect to do this.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]