2003-12-30 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Tue, 30 Dec 2003 12:02:47 +0000 (12:02 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Tue, 30 Dec 2003 12:02:47 +0000 (12:02 +0000)
* gnu/java/net/protocol/http/Connection.java
(requestProperties): New field.
(addRequestProperty): New method.
(getRequestProperty): New method.
(setRequestProperty): New method.
(getRequestProperties): New method.

From-SVN: r75228

libjava/ChangeLog
libjava/gnu/java/net/protocol/http/Connection.java

index a0d172557ae10dcd960674933a066c6414ff815e..13e8186ed07c289fc7f3354d97cd06bff81d5e82 100644 (file)
@@ -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 5cced5cf0a2925b3fd3133838719b949c0593b92..1a6d45c1769a5f76ef03839dd4603fe238f548a4 100644 (file)
@@ -49,6 +49,7 @@ import java.net.ProtocolException;
 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;
@@ -104,6 +105,11 @@ public final class Connection extends HttpURLConnection
    */
   private DataInputStream inputStream;
 
+  /**
+   * This object holds the request properties.
+   */
+  private HashMap requestProperties = new HashMap();
+
   /**
    * This is the object that holds the header field information
    */
@@ -368,6 +374,41 @@ public final class Connection extends HttpURLConnection
                                    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)
   {
     if (!connected)