Global.helma.Url (str)
Sourcecode in /home/hannes/helma/modules/helma/Url.js:
22:   helma.Url = function(str) {
23:       if (!str || !helma.Url.PATTERN.test(str))
24:           throw Error("Cannot create helma.Url: insufficient arguments");
25:   
26:       // filter punctuation from user-generated urls
27:       // FIXME: a) can this be done in helma.Url.PATTERN?
28:       //        b) should it be done rather in methods like activateUrls?
29:       str = str.replace(/[,.;:]\s/, "");
30:   
31:      var parts = helma.Url.PATTERN.exec(str);
32:      this.protocol = parts[1];
33:  
34:      if (!parts[2]) {
35:          if (parts[3])
36:              this.user = parts[3];
37:      } else {
38:          this.user = parts[2];
39:          if (parts[3])
40:              this.password = parts[3];
41:      }
42:  
43:      if (!parts[4])
44:          throw Error("Cannot create helma.Url: missing host part");
45:  
46:      this.domainName = parts[4]; // actually, the fully-qualified domain name
47:      var fqdnParts = this.domainName.split(".");
48:      if (fqdnParts.length < 3)
49:          this.host = "";
50:      else {
51:          this.host = fqdnParts[0];
52:          fqdnParts.splice(0, 1);
53:      }
54:      this.topLevelDomain = fqdnParts[fqdnParts.length-1];
55:      this.domain = fqdnParts.join(".");
56:  
57:      this.pathString = parts[5] || "";
58:      if (this.pathString.indexOf("/") == 0)
59:          this.pathString = this.pathString.substring(1);
60:      this.path = this.pathString.split("/");
61:      this.file = this.path.pop();
62:  
63:      if (parts[6]) {
64:          this.queryString = parts[6];
65:          var pairs;
66:          this.query = {};
67:          parts = parts[6].split("&");
68:          for (var i in parts) {
69:              pairs = parts[i].split("=");
70:              this.query[pairs[0]] = pairs[1];
71:          }
72:      }
73:  
74:      return this;
75:  }