diff options
author | Mark Wielaard <mark@klomp.org> | 2003-01-03 00:49:31 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2003-01-03 00:49:31 +0000 |
commit | 3e0cb4ff7cb5eaf12df6f3a54694743820603f14 (patch) | |
tree | abd4cbbbb64cffbf85eb0fa6f878b5d8e1184951 | |
parent | e55393db343affe9c0e0b46094bf21229c4bf9a3 (diff) | |
download | gcc-3e0cb4ff7cb5eaf12df6f3a54694743820603f14.tar.gz |
HttpURLConnection.java (HTTP_NOT_IMPLEMENTED): Must be public.
* java/net/HttpURLConnection.java (HTTP_NOT_IMPLEMENTED): Must be
public.
(HTTP_USE_PROXY): Add field.
(getResponseVals): Only set responseCode when not yet explicitly
set by subclass.
From-SVN: r60809
-rw-r--r-- | libjava/ChangeLog | 8 | ||||
-rw-r--r-- | libjava/java/net/HttpURLConnection.java | 58 |
2 files changed, 42 insertions, 24 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2d1b238e9c5..b6e84ca2bb5 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2003-01-02 Mark Wielaard <mark@klomp.org> + + * java/net/HttpURLConnection.java (HTTP_NOT_IMPLEMENTED): Must be + public. + (HTTP_USE_PROXY): Add field. + (getResponseVals): Only set responseCode when not yet explicitly + set by subclass. + 2003-01-02 Artur Biesiadowski <abies@pg.gda.pl> Mark Wielaard <mark@klomp.org> diff --git a/libjava/java/net/HttpURLConnection.java b/libjava/java/net/HttpURLConnection.java index e914b190203..ebc0f8175f4 100644 --- a/libjava/java/net/HttpURLConnection.java +++ b/libjava/java/net/HttpURLConnection.java @@ -142,6 +142,11 @@ public abstract class HttpURLConnection extends URLConnection * a conditional GET. */ public static final int HTTP_NOT_MODIFIED = 304; + + /** + * The requested resource needs to be accessed through a proxy. + */ + public static final int HTTP_USE_PROXY = 305; /* HTTP Client Error Response Codes */ @@ -250,7 +255,7 @@ public abstract class HttpURLConnection extends URLConnection * The server does not support the requested functionality. * @since 1.3 */ - static final int HTTP_NOT_IMPLEMENTED = 501; + public static final int HTTP_NOT_IMPLEMENTED = 501; /** * The proxy encountered a bad response from the server it was proxy-ing for @@ -459,31 +464,36 @@ public abstract class HttpURLConnection extends URLConnection connect(); gotResponseVals = true; - // Response is the first header received from the connection. - String respField = getHeaderField(0); - - if (respField == null || ! respField.startsWith("HTTP/")) - { - // Set to default values on failure. - responseCode = -1; - responseMessage = null; - return; - } - int firstSpc, nextSpc; - firstSpc = respField.indexOf(' '); - nextSpc = respField.indexOf(' ', firstSpc + 1); - responseMessage = respField.substring(nextSpc + 1); - String codeStr = respField.substring(firstSpc + 1, nextSpc); - try + // If responseCode not yet explicitly set by subclass + if (responseCode == -1) { - responseCode = Integer.parseInt(codeStr); - } - catch (NumberFormatException e) - { - // Set to default values on failure. - responseCode = -1; - responseMessage = null; + // Response is the first header received from the connection. + String respField = getHeaderField(0); + + if (respField == null || ! respField.startsWith("HTTP/")) + { + // Set to default values on failure. + responseCode = -1; + responseMessage = null; + return; + } + + int firstSpc, nextSpc; + firstSpc = respField.indexOf(' '); + nextSpc = respField.indexOf(' ', firstSpc + 1); + responseMessage = respField.substring(nextSpc + 1); + String codeStr = respField.substring(firstSpc + 1, nextSpc); + try + { + responseCode = Integer.parseInt(codeStr); + } + catch (NumberFormatException e) + { + // Set to default values on failure. + responseCode = -1; + responseMessage = null; + } } } |