activemq-cpp-3.9.5
|
This class represents an instance of a URI as defined by RFC 2396. More...
#include <src/main/decaf/net/URI.h>
Public Member Functions | |
URI () | |
Default Constructor, same as calling a Constructor with all fields empty. | |
URI (const URI &uri) | |
Constructs a URI as a copy of another URI. | |
URI (const std::string &uri) | |
Constructs a URI from the given string. | |
URI (const std::string &scheme, const std::string &ssp, const std::string &fragment) | |
Constructs a URI from the given components. | |
URI (const std::string &scheme, const std::string &userInfo, const std::string &host, int port, const std::string &path, const std::string &query, const std::string &fragment) | |
Constructs a URI from the given components. | |
URI (const std::string &scheme, const std::string &host, const std::string &path, const std::string &fragment) | |
Constructs a URI from the given components. | |
URI (const std::string &scheme, const std::string &authority, const std::string &path, const std::string &query, const std::string &fragment) | |
Constructs a URI from the given components. | |
virtual | ~URI () |
virtual int | compareTo (const URI &value) const |
Compares this object with the specified object for order. | |
virtual bool | equals (const URI &value) const |
virtual bool | operator== (const URI &value) const |
Compares equality between this object and the one passed. | |
virtual bool | operator< (const URI &value) const |
Compares this object to another and returns true if this object is considered to be less than the one passed. | |
std::string | getAuthority () const |
std::string | getFragment () const |
std::string | getHost () const |
std::string | getPath () const |
int | getPort () const |
std::string | getQuery () const |
std::string | getScheme () const |
std::string | getUserInfo () const |
std::string | getRawAuthority () const |
Returns the raw authority component of this URI. | |
std::string | getRawFragment () const |
Returns the raw fragment component of this URI. | |
std::string | getRawPath () const |
Returns the raw path component of this URI. | |
std::string | getRawQuery () const |
Returns the raw query component of this URI. | |
std::string | getRawSchemeSpecificPart () const |
Returns the raw scheme-specific part of this URI. | |
std::string | getSchemeSpecificPart () const |
Returns the decoded scheme-specific part of this URI. | |
std::string | getRawUserInfo () const |
Returns the raw user-information component of this URI. | |
bool | isAbsolute () const |
Tells whether or not this URI is absolute. | |
bool | isOpaque () const |
Tells whether or not this URI is opaque. | |
URI | normalize () const |
Normalizes this URI's path. | |
URI | parseServerAuthority () const |
Attempts to parse this URI's authority component, if defined, into user-information, host, and port components. | |
URI | relativize (const URI &uri) const |
Relativizes the given URI against this URI. | |
URI | resolve (const std::string &str) const |
Constructs a new URI by parsing the given string and then resolving it against this URI. | |
URI | resolve (const URI &uri) const |
Resolves the given URI against this URI. | |
std::string | toString () const |
Returns the content of this URI as a string. | |
URL | toURL () const |
Constructs a URL from this URI. | |
![]() | |
virtual | ~Comparable () |
virtual int | compareTo (const URI &value) const=0 |
Compares this object with the specified object for order. | |
virtual bool | equals (const URI &value) const=0 |
virtual bool | operator== (const URI &value) const=0 |
Compares equality between this object and the one passed. | |
virtual bool | operator< (const URI &value) const=0 |
Compares this object to another and returns true if this object is considered to be less than the one passed. | |
Static Public Member Functions | |
static URI | create (const std::string uri) |
Creates a URI by parsing the given string. | |
This class represents an instance of a URI as defined by RFC 2396.
decaf::net::URI::URI | ( | ) |
Default Constructor, same as calling a Constructor with all fields empty.
Referenced by compareTo(), create(), equals(), normalize(), operator<(), operator==(), parseServerAuthority(), relativize(), resolve(), resolve(), and URI().
Constructs a URI as a copy of another URI.
uri | - uri to copy |
URISyntaxException | if the URI passed is malformed. |
References URI().
decaf::net::URI::URI | ( | const std::string & | uri | ) |
Constructs a URI from the given string.
uri | - string uri to parse. |
URISyntaxException | if the URI passed is malformed. |
decaf::net::URI::URI | ( | const std::string & | scheme, |
const std::string & | ssp, | ||
const std::string & | fragment ) |
Constructs a URI from the given components.
scheme | - the uri scheme |
ssp | - Scheme specific part |
fragment | - Fragment |
URISyntaxException | if the URI passed is malformed. |
decaf::net::URI::URI | ( | const std::string & | scheme, |
const std::string & | userInfo, | ||
const std::string & | host, | ||
int | port, | ||
const std::string & | path, | ||
const std::string & | query, | ||
const std::string & | fragment ) |
Constructs a URI from the given components.
scheme | - Scheme name |
userInfo | - User name and authorization information |
host | - Host name |
port | - Port number |
path | - Path |
query | - Query |
fragment | - Fragment |
URISyntaxException | if the URI passed is malformed. |
decaf::net::URI::URI | ( | const std::string & | scheme, |
const std::string & | host, | ||
const std::string & | path, | ||
const std::string & | fragment ) |
Constructs a URI from the given components.
scheme | - Scheme name |
host | - Host name |
path | - Path |
fragment | - Fragment |
URISyntaxException | if the URI passed is malformed. |
decaf::net::URI::URI | ( | const std::string & | scheme, |
const std::string & | authority, | ||
const std::string & | path, | ||
const std::string & | query, | ||
const std::string & | fragment ) |
Constructs a URI from the given components.
scheme | - Scheme name |
authority | - Authority |
path | - Path |
query | - Query |
fragment | - Fragment |
URISyntaxException | if the URI passed is malformed. |
|
inlinevirtual |
Compares this object with the specified object for order.
Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
value | - the value to compare to this one. |
References URI().
Creates a URI by parsing the given string.
This convenience factory method works as if by invoking the URI(string) constructor; any URISyntaxException thrown by the constructor is caught and wrapped in a new IllegalArgumentException object, which is then thrown.
uri | - URI string to parse |
IllegalArgumentException |
References normalize(), and URI().
References URI().
std::string decaf::net::URI::getAuthority | ( | ) | const |
std::string decaf::net::URI::getFragment | ( | ) | const |
std::string decaf::net::URI::getHost | ( | ) | const |
std::string decaf::net::URI::getPath | ( | ) | const |
int decaf::net::URI::getPort | ( | ) | const |
std::string decaf::net::URI::getQuery | ( | ) | const |
std::string decaf::net::URI::getRawAuthority | ( | ) | const |
Returns the raw authority component of this URI.
The authority component of a URI, if defined, only contains the commercial-at character ('@') and characters in the unreserved, punct, escaped, and other categories. If the authority is server-based then it is further constrained to have valid user-information, host, and port components.
std::string decaf::net::URI::getRawFragment | ( | ) | const |
std::string decaf::net::URI::getRawPath | ( | ) | const |
std::string decaf::net::URI::getRawQuery | ( | ) | const |
std::string decaf::net::URI::getRawSchemeSpecificPart | ( | ) | const |
std::string decaf::net::URI::getRawUserInfo | ( | ) | const |
std::string decaf::net::URI::getScheme | ( | ) | const |
std::string decaf::net::URI::getSchemeSpecificPart | ( | ) | const |
Returns the decoded scheme-specific part of this URI.
The string returned by this method is equal to that returned by the getRawSchemeSpecificPart method except that all sequences of escaped octets are decoded.
std::string decaf::net::URI::getUserInfo | ( | ) | const |
bool decaf::net::URI::isAbsolute | ( | ) | const |
bool decaf::net::URI::isOpaque | ( | ) | const |
Tells whether or not this URI is opaque.
A URI is opaque if, and only if, it is absolute and its scheme-specific part does not begin with a slash character ('/'). An opaque URI has a scheme, a scheme-specific part, and possibly a fragment; all other components are undefined.
URI decaf::net::URI::normalize | ( | ) | const |
Normalizes this URI's path.
If this URI is opaque, or if its path is already in normal form, then this URI is returned. Otherwise a new URI is constructed that is identical to this URI except that its path is computed by normalizing this URI's path in a manner consistent with RFC 2396, section 5.2, step 6, sub-steps c through f; that is:
A normalized path will begin with one or more ".." segments if there were insufficient non-".." segments preceding them to allow their removal. A normalized path will begin with a "." segment if one was inserted by step 3 above. Otherwise, a normalized path will not contain any "." or ".." segments.
References URI().
Referenced by create().
Compares this object to another and returns true if this object is considered to be less than the one passed.
This
value | - the value to be compared to this one. |
References URI().
Compares equality between this object and the one passed.
value | - the value to be compared to this one. |
References URI().
URI decaf::net::URI::parseServerAuthority | ( | ) | const |
Attempts to parse this URI's authority component, if defined, into user-information, host, and port components.
If this URI's authority component has already been recognized as being server-based then it will already have been parsed into user-information, host, and port components. In this case, or if this URI has no authority component, this method simply returns this URI.
Otherwise this method attempts once more to parse the authority component into user-information, host, and port components, and throws an exception describing why the authority component could not be parsed in that way.
URISyntaxException | If the authority component of this URI is defined but cannot be parsed as a server-based authority. |
References URI().
Relativizes the given URI against this URI.
The relativization of the given URI against this URI is computed as follows:
References URI().
Constructs a new URI by parsing the given string and then resolving it against this URI.
This convenience method works as if invoking it were equivalent to evaluating the expression resolve( URI::create( str ) ).
str | The string to be parsed into a URI |
IllegalArgumentException | - If the given string violates RFC 2396 |
References URI().
Resolves the given URI against this URI.
If the given URI is already absolute, or if this URI is opaque, then a copy of the given URI is returned.
If the given URI's fragment component is defined, its path component is empty, and its scheme, authority, and query components are undefined, then a URI with the given fragment but with all other components equal to those of this URI is returned. This allows a URI representing a standalone fragment reference, such as "#foo", to be usefully resolved against a base URI.
Otherwise this method constructs a new hierarchical URI in a manner consistent with RFC 2396, section 5.2; that is:
The result of this method is absolute if, and only if, either this URI is absolute or the given URI is absolute.
References URI().
std::string decaf::net::URI::toString | ( | ) | const |
Returns the content of this URI as a string.
If this URI was created by invoking one of the constructors in this class then a string equivalent to the original input string, or to the string computed from the originally-given components, as appropriate, is returned. Otherwise this URI was created by normalization, resolution, or relativization, and so a string is constructed from this URI's components according to the rules specified in RFC 2396, section 5.2, step 7.
URL decaf::net::URI::toURL | ( | ) | const |
Constructs a URL from this URI.
This convenience method works as if invoking it were equivalent to evaluating the expression new URL(this.toString()) after first checking that this URI is absolute.
IllegalArgumentException | - If this URL is not absolute |
MalformedURLException | - If a protocol handler for the URL could not be found, or if some other error occurred while constructing the URL |