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: gnu.java.net.protocol.http.Connection


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

Hi list,


I commited the attached patch to merge more parts of 
gnu.java.net.protocol.http.Connection with classpath.


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

iD8DBQE/z4PqWSOgCCdjSDsRAqB+AJ9PaGbM0kcM8HxG21FvhQj6DS/gzQCbB0Py
K4pxDVgFksM8U0eP3eA69oI=
=jeSl
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2417
diff -u -b -B -r1.2417 ChangeLog
--- ChangeLog	4 Dec 2003 13:07:07 -0000	1.2417
+++ ChangeLog	4 Dec 2003 17:47:03 -0000
@@ -1,5 +1,13 @@
 2003-12-04  Michael Koch  <konqueror@gmx.de>
 
+	* gnu/java/net/protocol/http/Connection.java
+	(sendRequest): Merged writing http headers with classpath.
+	(getInputStream): Merged documentation from classpath.
+	(getHeaderField): Likewise.
+	(getHeaderFieldKey): Likewise.
+
+2003-12-04  Michael Koch  <konqueror@gmx.de>
+
 	* boehm.cc (_Jv_MarkObj): Access hack_signers field.
 
 2003-12-04  Michael Koch  <konqueror@gmx.de>
Index: gnu/java/net/protocol/http/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/http/Connection.java,v
retrieving revision 1.6
diff -u -b -B -r1.6 Connection.java
--- gnu/java/net/protocol/http/Connection.java	2 Dec 2003 14:13:46 -0000	1.6
+++ gnu/java/net/protocol/http/Connection.java	4 Dec 2003 17:47:03 -0000
@@ -48,10 +48,10 @@
 import java.net.Socket;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Vector;
 import java.util.Hashtable;
-import java.util.Enumeration;
 
 /**
  * This subclass of java.net.URLConnection models a URLConnection via
@@ -212,11 +212,13 @@
       setRequestProperty ("Host", url.getHost());
     
     // Write all req_props name-value pairs to the output writer.
-    Enumeration reqKeys = requestProperties.keys();
-    Enumeration reqVals = requestProperties.elements();
+    Iterator itr = getRequestProperties().entrySet().iterator();
     
-    while (reqKeys.hasMoreElements())
-      outputWriter.print (reqKeys.nextElement() + ": " + reqVals.nextElement() + "\r\n");
+    while (itr.hasNext())
+      {
+        Map.Entry e = (Map.Entry) itr.next();
+        outputWriter.print (e.getKey() + ": " + e.getValue() + "\r\n");
+      }
     
     // One more CR-LF indicates end of header.
     outputWriter.print ("\r\n");
@@ -234,6 +236,15 @@
     return proxyInUse;
   }
 
+  /**
+   * Returns an InputStream for reading from this connection.  This stream
+   * will be "queued up" for reading just the contents of the requested file.
+   * Overrides URLConnection.getInputStream()
+   *
+   * @return An InputStream for this connection.
+   *
+   * @exception IOException If an error occurs
+   */
   public InputStream getInputStream() throws IOException
   {
     if (!connected)
@@ -256,6 +267,25 @@
     return socket.getOutputStream();
   }
 
+  /**
+   * Overrides java.net.HttpURLConnection.setRequestMethod() in order to
+   * restrict the available methods to only those we support.
+   *
+   * @param method The RequestMethod to use
+   *
+   * @exception ProtocolException If the specified method is not valid
+   */
+  public void setRequestMethod (String method) throws ProtocolException
+  {
+    method = method.toUpperCase();
+    
+    if (method.equals("GET"))
+      super.setRequestMethod (method);
+    else
+      throw new ProtocolException ("Unsupported or unknown request method " +
+                                   method);
+  }
+
   public String getHeaderField(String name)
   {
     if (!connected)
@@ -286,6 +316,15 @@
     return hdrHash;
   }
 
+  /**
+   * This method returns the header field value at the specified numeric
+   * index.
+   *
+   * @param n The index into the header field array
+   *
+   * @return The value of the specified header field, or <code>null</code>
+   * if the specified index is not valid.
+   */
   public String getHeaderField(int n)
   {
     if (!connected)
@@ -303,6 +342,15 @@
     return null;
   }
 
+  /**
+   * This method returns the header field key at the specified numeric
+   * index.
+   *
+   * @param n The index into the header field array
+   *
+   * @return The name of the header field key, or <code>null</code> if the
+   * specified index is not valid.
+   */
   public String getHeaderFieldKey(int n)
   {
     if (!connected)

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