activemq-cpp-3.9.0
decaf::internal::net::URLUtils Class Reference

#include <src/main/decaf/internal/net/URLUtils.h>

Static Public Member Functions

static decaf::lang::String getHost (const decaf::net::URL &url)
 File based URL instance with an empty host value are always considered to have a host value of "localhost". More...
 
static decaf::lang::String canonicalizePath (const decaf::lang::String &original, bool discardRelativePrefix)
 Returns the path will relative path segments like ".." and "." resolved. More...
 
static decaf::lang::String authoritySafePath (const decaf::lang::String &authority, const decaf::lang::String &path)
 Returns a path that can be safely concatenated with the given authority. More...
 
static bool isValidSchemeChar (int index, char c)
 Returns true if the given char is valid for a URL scheme taking into account its position in the scheme string. More...
 
static decaf::lang::String getSchemePrefix (const decaf::lang::String &spec)
 Returns the scheme prefix like "http" from the URL spec, or empty if the spec doesn't start with a scheme. More...
 
static int findFirstOf (const decaf::lang::String &string, const decaf::lang::String &chars, int start, int end)
 Returns the index of the first char of the given set in the passed in String bounded between start and end. More...
 

Member Function Documentation

static decaf::lang::String decaf::internal::net::URLUtils::authoritySafePath ( const decaf::lang::String authority,
const decaf::lang::String path 
)
static

Returns a path that can be safely concatenated with the given authority.

If the authority is empty, this can be any path. Otherwise the paths run together like http://activemq.apache.html.

Parameters
authorityThe authority value from a given URL.
pathThe path value from a given URL.
Returns
a safe version of the Path value.
static decaf::lang::String decaf::internal::net::URLUtils::canonicalizePath ( const decaf::lang::String original,
bool  discardRelativePrefix 
)
static

Returns the path will relative path segments like ".." and "." resolved.

The returned path will not necessarily start with a "/" character. This handles ".." and "." segments at both the beginning and end of the path.

Parameters
discardRelativePrefixtrue to remove leading ".." segments from the path. This is appropriate for paths that are known to be absolute.
Returns
the canonicalized Path value.
static int decaf::internal::net::URLUtils::findFirstOf ( const decaf::lang::String string,
const decaf::lang::String chars,
int  start,
int  end 
)
static

Returns the index of the first char of the given set in the passed in String bounded between start and end.

This returns the end value if none of the characters exist in the requested range.

This is an optimization used in URL processing as the return value is end if the chars are not found in the string so that processing can continue from the returned end value no matter what the result is.

Parameters
stringThe string to search.
charsThe set of characters to search for in the target String.
startThe start index to search from.
endThe end index to stop the search at.
Returns
the first index that matches one of the chars or the end value if no matches..
static decaf::lang::String decaf::internal::net::URLUtils::getHost ( const decaf::net::URL url)
static

File based URL instance with an empty host value are always considered to have a host value of "localhost".

Parameters
urlthe URL whose host value is to be returned.
Returns
the host value or 'localhost' for file based protocols.
static decaf::lang::String decaf::internal::net::URLUtils::getSchemePrefix ( const decaf::lang::String spec)
static

Returns the scheme prefix like "http" from the URL spec, or empty if the spec doesn't start with a scheme.

Scheme prefixes match this pattern: (alpha ( alpha | digit | '+' | '-' | '.' )* ':')

static bool decaf::internal::net::URLUtils::isValidSchemeChar ( int  index,
char  c 
)
static

Returns true if the given char is valid for a URL scheme taking into account its position in the scheme string.

Parameters
indexThe index in the scheme where the char value is from.
cThe value from the given index.
Returns
true if the char value is valid for the given index.

The documentation for this class was generated from the following file: