Definition at line 40 of file url.h.
Public Member Functions | |
URL () | |
Default constructor (url is empty string). | |
URL (const URL &rhs) | |
Copy constructor. | |
URL (const String &url) throw ((MalformedURLException)) | |
Constructor from string url (throws if string is an invalid url). | |
URL (const URL &context, const String &location) throw ((MalformedURLException)) | |
Constructor for relative urls (relative to another url). | |
URL (const String &protocol, const String &protocol_data) throw ((MalformedURLException)) | |
Constructor from protocol and data. | |
String | get_host () const |
Returns url host. | |
String | get_path () const |
Returns url path. | |
int | get_port () const |
Returns the port used or -1 if no port specified or not applicable (e.g file: protocol). | |
bool | is_file () const |
Returns 'true' for the file protocol, 'false' for all others. | |
Private Attributes | |
URLImpl * | m_impl |
IT_Bus::URL::URL | ( | const String & | url | ) | throw ((MalformedURLException)) |
Constructor from string url (throws if string is an invalid url).
Valid urls have on of the following formats: URL("protocol:protocol_data"); URL("protocol://host:port/path") - a variant of the previous form URL("filename"); - filename could be a relative or absoulte path
Note on file urls: URLs are absolute by definition. For file urls an exception is made and relative urls are supported based on the *assumption* that they are relative to the current working directory. A mechanism for converting relative file location to absolute file based urls is implemented based on this assumption. File urls the following forms are valid: "myfile.xml" - relative (to the current directory) "../../myfile.xml" - relative (to the current directory) "..\..\myfile.xml" - relative (to the current directory, windows) "/mypath/subdir/myfile.xml" - absolute (unix), relative to current drive (windows) "\mypath\subdir\myfile.xml" - relative (to the current drive, windows) "d:\mypath\subdir\myfile.xml" - absolute (windows) "file:myfile.xml" - relative (to the current directory) "file:../../myfile.xml" - relative (to the current directory) "file:/mypath/subdir/myfile.xml" - absolute (unix), relative to current drive (windows) "file:///mypath/subdir/myfile.xml" - absolute (unix), relative to current drive (windows) "file:/c:/mypath/subdir\myfile.xml" - absolute (windows) "file:///c:/mypath/subdir\myfile.xml" absolute (windows) "file:\mypath\subdir\myfile.xml" - relative to current drive (windows)
Windows UNC Path syntax is supported as follows: "file:////<host>/<share>/<app_path>" "\<host><share><app_path>
The '\' (backslash) character will be converted to forward slash ('/'). Exclusive of Windows UNC path syntax, the string representation of a file url will always be of the following form: "file:/mypath/subdir/myfile.xml"
For a file URL the hostname is always empty and the port is -1. File URLs are irrelevant on the host different than the one where the file system resides and MUST not be passed to and used on other hosts (at least not to access file resources). File URLs MAY be bound to other constraints specific to the filesystem used (e.g case sensitive on Unix but not on Windows).