39 |
package java.net; |
package java.net; |
40 |
|
|
41 |
import java.io.InputStream; |
import java.io.InputStream; |
|
import java.io.OutputStream; |
|
42 |
import java.io.IOException; |
import java.io.IOException; |
43 |
|
import java.io.OutputStream; |
44 |
import java.security.Permission; |
import java.security.Permission; |
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; |
import java.util.Collections; |
49 |
import java.util.Date; |
import java.util.Date; |
50 |
|
import java.util.Locale; |
51 |
import java.util.Enumeration; |
import java.util.Enumeration; |
52 |
import java.util.Hashtable; |
import java.util.Hashtable; |
53 |
import java.util.Map; |
import java.util.Map; |
54 |
import java.util.Locale; |
|
55 |
|
/** |
56 |
|
* Written using on-line Java Platform 1.2 API Specification, as well |
57 |
|
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). |
58 |
|
* Status: One guessContentTypeFrom... methods not implemented. |
59 |
|
* getContent method assumes content type from response; see comment there. |
60 |
|
*/ |
61 |
|
|
62 |
/** |
/** |
63 |
* This class models a connection that retrieves the information pointed |
* This class models a connection that retrieves the information pointed |
71 |
* various connection options prior to calling the actual connect() method. |
* various connection options prior to calling the actual connect() method. |
72 |
* <p> |
* <p> |
73 |
* After the connection has been opened, there are a number of methods in |
* After the connection has been opened, there are a number of methods in |
74 |
* this class that access various attributes of the data, typically |
* this class that access various attributes of the data, typically |
75 |
* represented by headers sent in advance of the actual data itself. |
* represented by headers sent in advance of the actual data itself. |
76 |
* <p> |
* <p> |
77 |
* Also of note are the getInputStream and getContent() methods which allow |
* Also of note are the getInputStream and getContent() methods which allow |
87 |
* by the actual content handlers as described in the description of that |
* by the actual content handlers as described in the description of that |
88 |
* method. |
* method. |
89 |
* |
* |
90 |
* @version 0.5 |
* @author Aaron M. Renn <arenn@urbanophile.com> |
91 |
* |
* @author Warren Levy <warrenl@cygnus.com> |
|
* @author Aaron M. Renn (arenn@urbanophile.com) |
|
92 |
*/ |
*/ |
93 |
public abstract class URLConnection |
public abstract class URLConnection |
94 |
{ |
{ |
136 |
/** |
/** |
137 |
* Indicates whether or not input can be read from this URL |
* Indicates whether or not input can be read from this URL |
138 |
*/ |
*/ |
139 |
protected boolean doInput; |
protected boolean doInput = true; |
140 |
|
|
141 |
/** |
/** |
142 |
* Indicates whether or not output can be sent to this URL |
* Indicates whether or not output can be sent to this URL |
143 |
*/ |
*/ |
146 |
/** |
/** |
147 |
* If this flag is set, the protocol is allowed to cache data whenever |
* If this flag is set, the protocol is allowed to cache data whenever |
148 |
* it can (caching is not guaranteed). If it is not set, the protocol |
* it can (caching is not guaranteed). If it is not set, the protocol |
149 |
* must a get a fresh copy of the data. |
* must a get a fresh copy of the data. |
150 |
* <p> |
* <p> |
151 |
* This field is set by the setUseCaches method and returned by the |
* This field is set by the setUseCaches method and returned by the |
152 |
* getUseCaches method. |
* getUseCaches method. |
153 |
* |
* |
154 |
* Its default value is that determined by the last invocation of |
* Its default value is that determined by the last invocation of |
155 |
* setDefaultUseCaches |
* setDefaultUseCaches |
|
* |
|
156 |
*/ |
*/ |
157 |
protected boolean useCaches; |
protected boolean useCaches; |
158 |
|
|
162 |
* modified more recently than the date set in this variable. That date |
* modified more recently than the date set in this variable. That date |
163 |
* should be specified as the number of seconds since 1/1/1970 GMT. |
* should be specified as the number of seconds since 1/1/1970 GMT. |
164 |
*/ |
*/ |
165 |
protected long ifModifiedSince; |
protected long ifModifiedSince = 0L; |
166 |
|
|
167 |
/** |
/** |
168 |
* This is the URL associated with this connection |
* This is the URL associated with this connection |