jdk/src/share/classes/sun/net/www/URLConnection.java
author chegar
Fri, 16 Sep 2011 12:09:04 -0700
changeset 10596 39b3a979e600
parent 9775 1b128726e887
permissions -rw-r--r--
7090158: Networking Libraries don't build with javac -Werror Summary: Minor changes to networking java files to remove warnings Reviewed-by: chegar, weijun, hawtin Contributed-by: kurchi.subhra.hazra@oracle.com, sasha_bu@hotmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
10596
39b3a979e600 7090158: Networking Libraries don't build with javac -Werror
chegar
parents: 9775
diff changeset
     2
 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.net.www;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * A class to represent an active connection to an object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * represented by a URL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * @author  James Gosling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
abstract public class URLConnection extends java.net.URLConnection {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    /** The URL that it is connected to */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    private String contentType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private int contentLength = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    protected MessageHeader properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /** Create a URLConnection object.  These should not be created directly:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        instead they should be created by protocol handers in response to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        URL.openConnection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        @param  u       The URL that this connects to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    public URLConnection (URL u) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        super(u);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        properties = new MessageHeader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /** Call this routine to get the property list for this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Properties (like content-type) that have explicit getXX() methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * associated with them should be accessed using those methods.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public MessageHeader getProperties() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        return properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /** Call this routine to set the property list for this object. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public void setProperties(MessageHeader properties) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        this.properties = properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public void setRequestProperty(String key, String value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        if(connected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
            throw new IllegalAccessError("Already connected");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        if (key == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
            throw new NullPointerException ("key cannot be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        properties.set(key, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * The following three methods addRequestProperty, getRequestProperty,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * and getRequestProperties were copied from the superclass implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * before it was changed by CR:6230836, to maintain backward compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public void addRequestProperty(String key, String value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        if (connected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            throw new IllegalStateException("Already connected");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        if (key == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            throw new NullPointerException ("key is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public String getRequestProperty(String key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        if (connected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            throw new IllegalStateException("Already connected");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public Map<String,List<String>> getRequestProperties() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        if (connected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            throw new IllegalStateException("Already connected");
10596
39b3a979e600 7090158: Networking Libraries don't build with javac -Werror
chegar
parents: 9775
diff changeset
    97
        return Collections.emptyMap();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    public String getHeaderField(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            getInputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        return properties == null ? null : properties.findValue(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Return the key for the nth header field. Returns null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * there are fewer than n fields.  This can be used to iterate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * through all the headers in the message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    public String getHeaderFieldKey(int n) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            getInputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        MessageHeader props = properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        return props == null ? null : props.getKey(n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Return the value for the nth header field. Returns null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * there are fewer than n fields.  This can be used in conjunction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * with getHeaderFieldKey to iterate through all the headers in the message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    public String getHeaderField(int n) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            getInputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        MessageHeader props = properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        return props == null ? null : props.getValue(n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /** Call this routine to get the content-type associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    public String getContentType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        if (contentType == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            contentType = getHeaderField("content-type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        if (contentType == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            String ct = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                ct = guessContentTypeFromStream(getInputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            } catch(java.io.IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            String ce = properties.findValue("content-encoding");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            if (ct == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                ct = properties.findValue("content-type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                if (ct == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                    if (url.getFile().endsWith("/"))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                        ct = "text/html";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                        ct = guessContentTypeFromName(url.getFile());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
             * If the Mime header had a Content-encoding field and its value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
             * was not one of the values that essentially indicate no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
             * encoding, we force the content type to be unknown. This will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
             * cause a save dialog to be presented to the user.  It is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
             * ideal but is better than what we were previously doing, namely
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
             * bringing up an image tool for compressed tar files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            if (ct == null || ce != null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                    !(ce.equalsIgnoreCase("7bit")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                      || ce.equalsIgnoreCase("8bit")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                      || ce.equalsIgnoreCase("binary")))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                ct = "content/unknown";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            setContentType(ct);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        return contentType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Set the content type of this URL to a specific value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * @param   type    The content type to use.  One of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     *                  content_* static variables in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *                  class should be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *                  eg. setType(URL.content_html);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    public void setContentType(String type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        contentType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        properties.set("content-type", type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /** Call this routine to get the content-length associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    public int getContentLength() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            getInputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        int l = contentLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        if (l < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                l = Integer.parseInt(properties.findValue("content-length"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                setContentLength(l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            } catch(Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        return l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    /** Call this routine to set the content-length associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    protected void setContentLength(int length) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        contentLength = length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        properties.set("content-length", String.valueOf(length));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Returns true if the data associated with this URL can be cached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    public boolean canCache() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        return url.getFile().indexOf('?') < 0   /* && url.postData == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                REMIND */ ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * Call this to close the connection and flush any remaining data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * Overriders must remember to call super.close()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    public void close() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        url = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
9775
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   236
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   237
    private static HashMap<String,Void> proxiedHosts = new HashMap<>();
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   238
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   239
    public synchronized static void setProxiedHost(String host) {
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   240
        proxiedHosts.put(host.toLowerCase(), null);
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   241
    }
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   242
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   243
    public synchronized static boolean isProxiedHost(String host) {
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   244
        return proxiedHosts.containsKey(host.toLowerCase());
1b128726e887 7042550: Reintegrate 6569621
michaelm
parents: 9550
diff changeset
   245
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
}