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/, "");
|
str = str.replace(/[,.;:]\s/, "");
|
||||||
|
|
||||||
var parts = helma.Url.PATTERN.exec(str);
|
var parts = helma.Url.PATTERN.exec(str);
|
||||||
|
/**
|
||||||
|
* Protocol segment of this URL
|
||||||
|
*/
|
||||||
this.protocol = parts[1];
|
this.protocol = parts[1];
|
||||||
|
|
||||||
if (!parts[2]) {
|
if (!parts[2]) {
|
||||||
if (parts[3])
|
if (parts[3])
|
||||||
|
/**
|
||||||
|
* User name segment of this URL
|
||||||
|
*/
|
||||||
this.user = parts[3];
|
this.user = parts[3];
|
||||||
} else {
|
} else {
|
||||||
this.user = parts[2];
|
this.user = parts[2];
|
||||||
if (parts[3])
|
if (parts[3])
|
||||||
|
/**
|
||||||
|
* Password segment of this URL
|
||||||
|
*/
|
||||||
this.password = parts[3];
|
this.password = parts[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parts[4])
|
if (!parts[4])
|
||||||
throw Error("Cannot create helma.Url: missing host part");
|
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
|
this.domainName = parts[4]; // actually, the fully-qualified domain name
|
||||||
var fqdnParts = this.domainName.split(".");
|
var fqdnParts = this.domainName.split(".");
|
||||||
if (fqdnParts.length < 3)
|
if (fqdnParts.length < 3)
|
||||||
this.host = "";
|
this.host = "";
|
||||||
else {
|
else {
|
||||||
|
/**
|
||||||
|
* Host name segment of this URL
|
||||||
|
*/
|
||||||
this.host = fqdnParts[0];
|
this.host = fqdnParts[0];
|
||||||
fqdnParts.splice(0, 1);
|
fqdnParts.splice(0, 1);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Top level domain name segment of this URL
|
||||||
|
*/
|
||||||
this.topLevelDomain = fqdnParts[fqdnParts.length-1];
|
this.topLevelDomain = fqdnParts[fqdnParts.length-1];
|
||||||
|
/**
|
||||||
|
* Domain name segment of this URL
|
||||||
|
*/
|
||||||
this.domain = fqdnParts.join(".");
|
this.domain = fqdnParts.join(".");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request path segment of this URL as string
|
||||||
|
*/
|
||||||
this.pathString = parts[5] || "";
|
this.pathString = parts[5] || "";
|
||||||
if (this.pathString.indexOf("/") == 0)
|
if (this.pathString.indexOf("/") == 0)
|
||||||
this.pathString = this.pathString.substring(1);
|
this.pathString = this.pathString.substring(1);
|
||||||
|
/**
|
||||||
|
* Request path segment of this URL as array
|
||||||
|
*/
|
||||||
this.path = this.pathString.split("/");
|
this.path = this.pathString.split("/");
|
||||||
|
/**
|
||||||
|
* File name segment of this URL
|
||||||
|
*/
|
||||||
this.file = this.path.pop();
|
this.file = this.path.pop();
|
||||||
|
|
||||||
if (parts[6]) {
|
if (parts[6]) {
|
||||||
|
/**
|
||||||
|
* Query parameter segment of this URL as string
|
||||||
|
*/
|
||||||
this.queryString = parts[6];
|
this.queryString = parts[6];
|
||||||
var pairs;
|
var pairs;
|
||||||
|
/**
|
||||||
|
* Query parameter segment of this URL as object
|
||||||
|
*/
|
||||||
this.query = {};
|
this.query = {};
|
||||||
parts = parts[6].split("&");
|
parts = parts[6].split("&");
|
||||||
for (var i in parts) {
|
for (var i in parts) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue