This class contains setters and getters for the parts of the URI.
The getXyz/setXyz methods return the decoded part
-- sogoog.Uri.parse('/foo%20bar').getPath() will return the
decoded path, /foo bar.
The constructor accepts an optional unparsed, raw URI string. The parser
is relaxed, so special characters that aren't escaped but don't cause
ambiguities will not cause parse failures.
All setters return this and so may be chained, a la
goog.Uri.parse('/foo').setFragment('part').toString().
| Instance Method Summary | |
clone() ⇒ !goog.UriClones the URI instance. | |
enforceReadOnly()Checks if this Uri has been marked as read only, and if so, throws an error. This should be called whenever any modifying function is called. | |
getDecodedQuery() ⇒ string | |
getDomain() ⇒ string | |
getEncodedQuery() ⇒ string | |
getFragment() ⇒ string | |
getIgnoreCase() ⇒ boolean | |
getParameterValue(string paramName) ⇒ <Any Type>Returns the first value for a given cgi parameter or undefined if the given parameter name does not appear in the query string. | |
getParameterValues(string name) ⇒ ?ArrayReturns the values for a given cgi parameter as a list of decoded query parameter values. | |
getPath() ⇒ string | |
getPort() ⇒ ?number | |
getQuery() ⇒ string | |
getQueryData() ⇒ ?goog.Uri.QueryDataReturns the query data. | |
getScheme() ⇒ string | |
getUserInfo() ⇒ string | |
hasDomain() ⇒ boolean | |
hasFragment() ⇒ boolean | |
hasPath() ⇒ boolean | |
hasPort() ⇒ boolean | |
hasQuery() ⇒ boolean | |
hasSameDomainAs(?goog.Uri uri2) ⇒ booleanReturns true if this has the same domain as that of uri2. | |
hasScheme() ⇒ boolean | |
hasUserInfo() ⇒ boolean | |
isReadOnly() ⇒ boolean | |
makeUnique() ⇒ !goog.UriAdds a random parameter to the Uri. | |
removeParameter(string key) ⇒ !goog.UriRemoves the named query parameter. | |
resolve(?goog.Uri relativeUri) ⇒ !goog.UriResolves a relative url string to a this base uri.
There are several kinds of relative urls: | |
setDomain(string newDomain, boolean= opt_decode) ⇒ !goog.UriSets the domain. | |
setFragment(string newFragment, boolean= opt_decode) ⇒ !goog.UriSets the URI fragment. | |
setIgnoreCase(boolean ignoreCase) ⇒ !goog.UriSets whether to ignore case. NOTE: If there are already key/value pairs in the QueryData, and ignoreCase_ is set to false, the keys will all be lower-cased. | |
setParameterValue(string key, <Any Type> value) ⇒ !goog.UriSets the value of the named query parameters, clearing previous values for that key. | |
setParameterValues(string key, <Any Type> values) ⇒ !goog.UriSets the values of the named query parameters, clearing previous values for
that key. Not new values will currently be moved to the end of the query
string.
So, | |
setPath(string newPath, boolean= opt_decode) ⇒ !goog.UriSets the path. | |
setPort(<Any Type> newPort) ⇒ !goog.UriSets the port number. | |
setQuery(string newQuery, boolean= opt_decode) ⇒ !goog.UriSets the URI query. | |
setQueryData((goog.Uri.QueryData|null|string|undefined) queryData, boolean= opt_decode) ⇒ !goog.UriSets the query data. | |
setReadOnly(boolean isReadOnly) ⇒ !goog.UriSets whether Uri is read only. If this goog.Uri is read-only, enforceReadOnly_ will be called at the start of any function that may modify this Uri. | |
setScheme(string newScheme, boolean= opt_decode) ⇒ !goog.UriSets the scheme/protocol. | |
setUserInfo(string newUserInfo, boolean= opt_decode) ⇒ !goog.UriSets the userInfo. | |
toString() ⇒ string | |
| Static Method Summary | |
create(?string= opt_scheme, ?string= opt_userInfo, ?string= opt_domain, ?number= opt_port, ?string= opt_path, (goog.Uri.QueryData|null|string=) opt_query, ?string= opt_fragment, boolean= opt_ignoreCase) ⇒ !goog.UriCreates a new goog.Uri object from unencoded parts. | |
decodeOrEmpty_((string|undefined) val) ⇒ stringDecodes a value or returns the empty string if it isn't defined or empty. | |
encodeChar_(string ch) ⇒ stringConverts a character in [\01-\177] to its unicode character equivalent. | |
encodeSpecialChars_(<Any Type> unescapedPart, ?RegExp extra) ⇒ ?stringIf unescapedPart is non null, then escapes any characters in it that aren't valid characters in a url and also escapes any special characters that appear in extra. | |
encodeString_(<Any Type> unescapedPart) ⇒ ?stringURI encode a string, or return null if it's not a string. | |
haveSameDomain(string uri1String, string uri2String) ⇒ booleanChecks whether two URIs have the same domain. | |
parse(<Any Type> uri, boolean= opt_ignoreCase) ⇒ !goog.UriCreates a uri from the string form. Basically an alias of new goog.Uri(). If a Uri object is passed to parse then it will return a clone of the object. | |
removeDotSegments(string path) ⇒ stringRemoves dot segments in given path component, as described in RFC 3986, section 5.2.4. | |
resolve(<Any Type> base, <Any Type> rel) ⇒ !goog.UriResolves a relative Uri against a base Uri, accepting both strings and Uri objects. | |