- Defines the behavior of the function if the URL is given as a relative path.
The parameter can take one of three values
-
"relative" - A relative path is passed as relative. Example:
-
"root" - Relative paths are interpreted as a path specified from the root. Example:
-
"server" - The first element of a relative path is interpreted as the name of the server. Example:
Example: Relative mode
console.log(new fcf.RouteInfo("part/item?query=1"))
Output:
{
"url": "part/item?query=1",
"referer": "part/item",
"uri": "part/item",
"urlArgs": {
"query": 1
},
"urlArgsRaw": {
"query": "1"
},
"urlArgsStr": "query=1",
"postArgs": {},
"postArgsRaw": {},
"args": {
"query": 1
},
"argsRaw": {
"query": "1"
},
"subUri": "",
"anchor": "",
"server": "",
"protocol": ""
}
Example: Root mode
console.log(new fcf.RouteInfo("part/item?query=1", "root"))
Output:
{
"url": "/part/item?query=1",
"referer": "/part/item",
"uri": "/part/item",
"urlArgs": {
"query": 1
},
"urlArgsRaw": {
"query": "1"
},
"urlArgsStr": "query=1",
"postArgs": {},
"postArgsRaw": {},
"args": {
"query": 1
},
"argsRaw": {
"query": "1"
},
"subUri": "",
"anchor": "",
"server": "",
"protocol": ""
}
Example: Server mode
console.log(new fcf.RouteInfo("part.org:8080/item?query=1", "server"))
Output:
{
"url": "http://part.org:8080/item?query=1",
"referer": "http://part.org:8080/item",
"uri": "/item",
"urlArgs": {
"query": 1
},
"urlArgsRaw": {
"query": "1"
},
"urlArgsStr": "query=1",
"postArgs": {},
"postArgsRaw": {},
"args": {
"query": 1
},
"argsRaw": {
"query": "1"
},
"subUri": "",
"anchor": "",
"server": "part.org",
"port": 8080,
"protocol": "http"
}