1 |
/* URLConnection.java -- Abstract superclass for reading from URL's |
/* URLConnection.java -- Abstract superclass for reading from URL's |
2 |
Copyright (C) 1998 Free Software Foundation, Inc. |
Copyright (C) 1998, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
45 |
import java.text.DateFormat; |
import java.text.DateFormat; |
46 |
import java.text.ParsePosition; |
import java.text.ParsePosition; |
47 |
import java.text.ParseException; |
import java.text.ParseException; |
48 |
|
import java.util.Collections; |
49 |
import java.util.Date; |
import java.util.Date; |
50 |
import java.util.Enumeration; |
import java.util.Enumeration; |
51 |
import java.util.Hashtable; |
import java.util.Hashtable; |
52 |
|
import java.util.Map; |
53 |
import java.util.Locale; |
import java.util.Locale; |
54 |
|
|
55 |
/** |
/** |
180 |
/** |
/** |
181 |
* The list of request properties for this connection |
* The list of request properties for this connection |
182 |
*/ |
*/ |
183 |
private Hashtable req_props = new Hashtable(10); |
private final Hashtable req_props; |
184 |
|
|
185 |
/*************************************************************************/ |
/*************************************************************************/ |
186 |
|
|
357 |
allowUserInteraction = def_allow_user_inter; |
allowUserInteraction = def_allow_user_inter; |
358 |
useCaches = def_use_caches; |
useCaches = def_use_caches; |
359 |
|
|
360 |
Enumeration e = def_req_props.keys(); |
req_props = new Hashtable(def_req_props); |
|
while (e.hasMoreElements()) |
|
|
{ |
|
|
String key = (String)e.nextElement(); |
|
|
String value = (String)def_req_props.get(key); |
|
|
|
|
|
req_props.put(key, value); |
|
|
} |
|
361 |
} |
} |
362 |
|
|
363 |
/*************************************************************************/ |
/*************************************************************************/ |
566 |
* @param key The name of the property |
* @param key The name of the property |
567 |
* @param value The value of the property |
* @param value The value of the property |
568 |
*/ |
*/ |
569 |
public synchronized void |
public void |
570 |
setRequestProperty(String key, String value) |
setRequestProperty(String key, String value) |
571 |
{ |
{ |
572 |
req_props.put(key.toLowerCase(), value); |
req_props.put(key.toLowerCase(), value); |
573 |
} |
} |
574 |
|
|
575 |
|
/** |
576 |
|
* Returns an unmodifiable Map containing the request properties. |
577 |
|
* |
578 |
|
* @since 1.4 |
579 |
|
*/ |
580 |
|
public Map |
581 |
|
getRequestProperties() |
582 |
|
{ |
583 |
|
return Collections.unmodifiableMap(req_props); |
584 |
|
} |
585 |
|
|
586 |
/*************************************************************************/ |
/*************************************************************************/ |
587 |
|
|
588 |
/** |
/** |