diff options
author | Michael Koch <konqueror@gmx.de> | 2003-12-30 12:02:47 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-12-30 12:02:47 +0000 |
commit | b976c2fc2962376675a381fbccc814d546b1dfd4 (patch) | |
tree | c735903692e26763f1b0632578321059cb6e95fd | |
parent | a27cf81c7a193551238e3491e556fd73a7d63a34 (diff) | |
download | gcc-b976c2fc2962376675a381fbccc814d546b1dfd4.zip gcc-b976c2fc2962376675a381fbccc814d546b1dfd4.tar.gz gcc-b976c2fc2962376675a381fbccc814d546b1dfd4.tar.bz2 |
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.
From-SVN: r75228
-rw-r--r-- | libjava/ChangeLog | 9 | ||||
-rw-r--r-- | libjava/gnu/java/net/protocol/http/Connection.java | 41 |
2 files changed, 50 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index a0d1725..13e8186 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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 diff --git a/libjava/gnu/java/net/protocol/http/Connection.java b/libjava/gnu/java/net/protocol/http/Connection.java index 5cced5c..1a6d45c 100644 --- a/libjava/gnu/java/net/protocol/http/Connection.java +++ b/libjava/gnu/java/net/protocol/http/Connection.java @@ -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; @@ -105,6 +106,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 */ private HeaderFieldHelper headers = new HeaderFieldHelper(); @@ -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) |