added jsdoc comments documenting the various properties of helma.Url objects
This commit is contained in:
parent
87ed97d3a3
commit
c17e1df282
1 changed files with 36 additions and 0 deletions
36
helma/Url.js
36
helma/Url.js
|
@ -38,40 +38,76 @@ helma.Url = function(str) {
|
|||
str = str.replace(/[,.;:]\s/, "");
|
||||
|
||||
var parts = helma.Url.PATTERN.exec(str);
|
||||
/**
|
||||
* Protocol segment of this URL
|
||||
*/
|
||||
this.protocol = parts[1];
|
||||
|
||||
if (!parts[2]) {
|
||||
if (parts[3])
|
||||
/**
|
||||
* User name segment of this URL
|
||||
*/
|
||||
this.user = parts[3];
|
||||
} else {
|
||||
this.user = parts[2];
|
||||
if (parts[3])
|
||||
/**
|
||||
* Password segment of this URL
|
||||
*/
|
||||
this.password = parts[3];
|
||||
}
|
||||
|
||||
if (!parts[4])
|
||||
throw Error("Cannot create helma.Url: missing host part");
|
||||
|
||||
/**
|
||||
* Fully qualified domain name segment of this URL
|
||||
*/
|
||||
this.domainName = parts[4]; // actually, the fully-qualified domain name
|
||||
var fqdnParts = this.domainName.split(".");
|
||||
if (fqdnParts.length < 3)
|
||||
this.host = "";
|
||||
else {
|
||||
/**
|
||||
* Host name segment of this URL
|
||||
*/
|
||||
this.host = fqdnParts[0];
|
||||
fqdnParts.splice(0, 1);
|
||||
}
|
||||
/**
|
||||
* Top level domain name segment of this URL
|
||||
*/
|
||||
this.topLevelDomain = fqdnParts[fqdnParts.length-1];
|
||||
/**
|
||||
* Domain name segment of this URL
|
||||
*/
|
||||
this.domain = fqdnParts.join(".");
|
||||
|
||||
/**
|
||||
* Request path segment of this URL as string
|
||||
*/
|
||||
this.pathString = parts[5] || "";
|
||||
if (this.pathString.indexOf("/") == 0)
|
||||
this.pathString = this.pathString.substring(1);
|
||||
/**
|
||||
* Request path segment of this URL as array
|
||||
*/
|
||||
this.path = this.pathString.split("/");
|
||||
/**
|
||||
* File name segment of this URL
|
||||
*/
|
||||
this.file = this.path.pop();
|
||||
|
||||
if (parts[6]) {
|
||||
/**
|
||||
* Query parameter segment of this URL as string
|
||||
*/
|
||||
this.queryString = parts[6];
|
||||
var pairs;
|
||||
/**
|
||||
* Query parameter segment of this URL as object
|
||||
*/
|
||||
this.query = {};
|
||||
parts = parts[6].split("&");
|
||||
for (var i in parts) {
|
||||
|
|
Loading…
Add table
Reference in a new issue