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


Hi list,


I commited the attached patch to add support for request properties again.


Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2497
diff -u -b -B -r1.2497 ChangeLog
--- ChangeLog	28 Dec 2003 21:30:43 -0000	1.2497
+++ ChangeLog	30 Dec 2003 12:01:44 -0000
@@ -1,3 +1,12 @@
+2003-12-30  Michael Koch  <konqueror@gmx.de>
+
+	* gnu/java/net/protocol/http/Connection.java
+	(requestProperties): New field.
+	(addRequestProperty): New method.
+	(getRequestProperty): New method.
+	(setRequestProperty): New method.
+	(getRequestProperties): New method.
+
 2003-12-28  Michael Koch  <konqueror@gmx.de>
 
 	* gnu/java/net/protocol/http/Connection.java
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.10
diff -u -b -B -r1.10 Connection.java
--- gnu/java/net/protocol/http/Connection.java	28 Dec 2003 21:30:45 -0000	1.10
+++ gnu/java/net/protocol/http/Connection.java	30 Dec 2003 12:01:44 -0000
@@ -49,6 +49,7 @@
 import java.net.Socket;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import gnu.java.net.HeaderFieldHelper;
@@ -105,6 +106,11 @@
   private DataInputStream inputStream;
 
   /**
+   * This object holds the request properties.
+   */
+  private HashMap requestProperties = new HashMap();
+
+  /**
    * This is the object that holds the header field information
    */
   private HeaderFieldHelper headers = new HeaderFieldHelper();
@@ -366,6 +372,41 @@
     else
       throw new ProtocolException ("Unsupported or unknown request method " +
                                    method);
+  }
+
+  public void addRequestProperty(String key, String value)
+  {
+    if (connected)
+      throw new IllegalStateException("Already connected");
+    
+    String old = (String) requestProperties.put(key, value);
+
+    if (old != null)
+      requestProperties.put(key, old + "," + value);
+  }
+
+  public String getRequestProperty(String key)
+  {
+    if (connected)
+      throw new IllegalStateException("Already connected");
+    
+    return (String) requestProperties.get(key);
+  }
+
+  public void setRequestProperty(String key, String value)
+  {
+    if (connected)
+      throw new IllegalStateException("Already connected");
+    
+    requestProperties.put(key, value);
+  }
+
+  public Map getRequestProperties()
+  {
+    if (connected)
+      throw new IllegalStateException("Already connected");
+    
+    return requestProperties;
   }
 
   public String getHeaderField(String name)

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