1 Clazz.declarePackage ("java.net");
\r
2 Clazz.load (null, "java.net.URLConnection", ["java.lang.IllegalStateException", "$.NullPointerException", "java.net.UnknownServiceException", "JU.Lst"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
6 this.doOutput = false;
\r
7 this.connected = false;
\r
8 this.requests = null;
\r
9 Clazz.instantialize (this, arguments);
\r
10 }, java.net, "URLConnection");
\r
11 Clazz.defineMethod (c$, "setDoInput",
\r
12 function (doinput) {
\r
13 if (this.connected) throw new IllegalStateException ("Already connected");
\r
14 this.doInput = doinput;
\r
16 Clazz.defineMethod (c$, "getDoInput",
\r
18 return this.doInput;
\r
20 Clazz.defineMethod (c$, "setDoOutput",
\r
21 function (dooutput) {
\r
22 if (this.connected) throw new IllegalStateException ("Already connected");
\r
23 this.doOutput = dooutput;
\r
25 Clazz.defineMethod (c$, "getDoOutput",
\r
27 return this.doOutput;
\r
29 Clazz.makeConstructor (c$,
\r
33 Clazz.defineMethod (c$, "getURL",
\r
37 Clazz.defineMethod (c$, "getInputStream",
\r
39 throw new java.net.UnknownServiceException ("protocol doesn't support input");
\r
41 Clazz.defineMethod (c$, "getOutputStream",
\r
43 throw new java.net.UnknownServiceException ("protocol doesn't support output");
\r
45 Clazz.defineMethod (c$, "setRequestProperty",
\r
46 function (key, value) {
\r
47 if (this.connected) throw new IllegalStateException ("Already connected");
\r
48 if (key == null) throw new NullPointerException ("key is null");
\r
49 if (this.requests == null) this.requests = new JU.Lst ();
\r
50 for (var i = this.requests.size (); --i >= 0; ) if (this.requests.get (i)[0].equals (key)) {
\r
51 this.requests.get (i)[1] = value;
\r
54 this.requests.addLast ( Clazz.newArray (-1, [key, value]));
\r