Class goog.Uri
code »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().
Constructor
| Parameters |
|---|
|
Classes
|
Instance Methods
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.
code »getDecodedQuery ( ) ⇒ string
string| Returns |
|---|
|
code »getEncodedQuery ( ) ⇒ string
string| Returns |
|---|
|
code »getFragment ( ) ⇒ string
string| Returns |
|---|
|
code »getIgnoreCase ( ) ⇒ boolean
boolean| Returns |
|---|
|
code »getParameterValue ( paramName ) ⇒ (string|undefined)Returns the first value for a given cgi parameter or undefined if the given
parameter name does not appear in the query string.
(string|undefined)| Parameters |
|---|
|
| Returns |
|
code »getParameterValues ( name ) ⇒ ArrayReturns the values for a given cgi parameter as a list of decoded
query parameter values.
Array| Parameters |
|---|
|
| Returns |
|
Returns the query data.
| Returns |
|---|
|
code »getUserInfo ( ) ⇒ string
string| Returns |
|---|
|
code »hasFragment ( ) ⇒ boolean
boolean| Returns |
|---|
|
code »hasSameDomainAs ( uri2 ) ⇒ booleanReturns true if this has the same domain as that of uri2.
boolean| Parameters |
|---|
|
| Returns |
|
code »hasUserInfo ( ) ⇒ boolean
boolean| Returns |
|---|
|
code »isReadOnly ( ) ⇒ boolean
boolean| Returns |
|---|
|
code »makeUnique ( ) ⇒ !goog.UriAdds a random parameter to the Uri.
!goog.Uri| Returns |
|---|
|
code »removeParameter ( key ) ⇒ !goog.UriRemoves the named query parameter.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
Resolves the given relative URI (a goog.Uri object), using the URI
represented by this instance as the base URI.
There are several kinds of relative URIs:
1. foo - replaces the last part of the path, the whole query and fragment
2. /foo - replaces the the path, the query and fragment
3. //foo - replaces everything from the domain on. foo is a domain name
4. ?foo - replace the query and fragment
5. #foo - replace the fragment only
Additionally, if relative URI has a non-empty path, all ".." and "."
segments will be resolved, as described in RFC 3986.
1. foo - replaces the last part of the path, the whole query and fragment
2. /foo - replaces the the path, the query and fragment
3. //foo - replaces everything from the domain on. foo is a domain name
4. ?foo - replace the query and fragment
5. #foo - replace the fragment only Additionally, if relative URI has a non-empty path, all ".." and "." segments will be resolved, as described in RFC 3986.
| Parameters |
|---|
|
| Returns |
|
code »setFragment ( newFragment, opt_decode ) ⇒ !goog.UriSets the URI fragment.
!goog.Uricode »setIgnoreCase ( 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.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
code »setParameterValue ( key, value ) ⇒ !goog.UriSets the value of the named query parameters, clearing previous values for
that key.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
code »setParameterValues ( key, 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, goog.Uri.parse('foo?a=b&c=d&e=f').setParameterValues('c', ['new'])
yields foo?a=b&e=f&c=new.
!goog.Urigoog.Uri.parse('foo?a=b&c=d&e=f').setParameterValues('c', ['new'])
yields foo?a=b&e=f&c=new.| Parameters |
|---|
|
| Returns |
|
code »setQueryData ( queryData, opt_decode ) ⇒ !goog.UriSets the query data.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
code »setReadOnly ( 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.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
code »setUserInfo ( newUserInfo, opt_decode ) ⇒ !goog.UriSets the userInfo.
!goog.UriInstance Properties
Whether or not to ignore case when comparing query params.
Whether or not this Uri should be treated as Read Only.
Object representing query data.
Static Functions
code »goog.Uri.create ( opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_query, opt_fragment, opt_ignoreCase ) ⇒ !goog.UriCreates a new goog.Uri object from unencoded parts.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
code »goog.Uri.decodeOrEmpty_ ( val ) ⇒ stringDecodes a value or returns the empty string if it isn't defined or empty.
stringcode »goog.Uri.encodeChar_ ( ch ) ⇒ stringConverts a character in [\01-\177] to its unicode character equivalent.
string| Parameters |
|---|
|
| Returns |
|
code »goog.Uri.encodeSpecialChars_ ( unescapedPart, 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.
?string| Parameters |
|---|
|
| Returns |
|
code »goog.Uri.haveSameDomain ( uri1String, uri2String ) ⇒ booleanChecks whether two URIs have the same domain.
booleancode »goog.Uri.parse ( uri, 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.
!goog.Uri| Parameters |
|---|
|
| Returns |
|
code »goog.Uri.removeDotSegments ( path ) ⇒ stringRemoves dot segments in given path component, as described in
RFC 3986, section 5.2.4.
string| Parameters |
|---|
|
| Returns |
|
code »goog.Uri.resolve ( base, rel ) ⇒ !goog.UriResolves a relative Uri against a base Uri, accepting both strings and
Uri objects.
!goog.Uri| Parameters |
|---|
|
| Returns |
|