JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / JU / AjaxURLStreamHandler.js
1 Clazz.declarePackage ("JU");\r
2 Clazz.load (["java.net.URLStreamHandler"], "JU.AjaxURLStreamHandler", ["JU.AjaxURLConnection", "$.SB"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.protocol = null;\r
5 Clazz.instantialize (this, arguments);\r
6 }, JU, "AjaxURLStreamHandler", java.net.URLStreamHandler);\r
7 Clazz.makeConstructor (c$, \r
8 function (protocol) {\r
9 Clazz.superConstructor (this, JU.AjaxURLStreamHandler, []);\r
10 this.protocol = protocol;\r
11 }, "~S");\r
12 Clazz.overrideMethod (c$, "openConnection", \r
13 function (url) {\r
14 return  new JU.AjaxURLConnection (url);\r
15 }, "java.net.URL");\r
16 Clazz.overrideMethod (c$, "toExternalForm", \r
17 function (u) {\r
18 var result =  new JU.SB ();\r
19 result.append (u.getProtocol ());\r
20 result.append (":");\r
21 if (u.getAuthority () != null && u.getAuthority ().length > 0) {\r
22 result.append ("//");\r
23 result.append (u.getAuthority ());\r
24 }if (u.getPath () != null) {\r
25 result.append (u.getPath ());\r
26 }if (u.getQuery () != null) {\r
27 result.append ("?");\r
28 result.append (u.getQuery ());\r
29 }if (u.getRef () != null) {\r
30 result.append ("#");\r
31 result.append (u.getRef ());\r
32 }return result.toString ();\r
33 }, "java.net.URL");\r
34 });\r