class URL

URL class refers to Uniform Resource Locator and can be used to locate resources on the Internet

Public Methods

URL ()
Constructs a null URL
URL (const string& url)
Constructs this object
URL (const string& protocol, const string& host, int port, const string& file)
Constructs this object
~URL ()
Destructor
const string& getProtocol () const
Returns a string containing the protocol of this url object
const string& getHost () const
Returns a string containing the host of this url object
int getPort () const
Returns an integer containing the port of this url object
const string& getFile () const
Returns a string containing the file name of the information to be retrieved from this url
string toString () const
Returns the string representation of this url
URLConnection getURLConnection () const
Returns a URLConnection object associated with the URL
operator void* () const
bool operator== (const URL& url) const
string paramString () const
Returns a string representation for URL, which is used debugging purposes

Documentation

URL class refers to Uniform Resource Locator and can be used to locate resources on the Internet. An example of a url is

http://www-itg.lbl.gov/Akenti

A URL is comprised of the following:
protocol - the protocol (http, file, ldap etc.) that should be used
host - the host to be connected to
port - the port to connect to
file - the file/information to be retrieved

In the above example, the protocol to use is http and the host to connect is www-itg.lbl.gov . The port information is not given and hence the default port is used. The file component to be retrieved is Akenti . If a directory is given, an index of files that belong to that directory will be displayed. If a default file (for ex., index.html) is available under that directory, as configured in the web server, then that file will be retrieved. You must specify a filename if the file to be retrieved is different from the default file in that directory.

The default port for the http protocol is 80. Any other port should be explicitly mentioned in the URL as follows
http://imglib.lbl.gov:8080/downloads

There is no Anchor '#" support for this URL. Hence it will be considered as a part of the file to be retrieved. This URL is a final class and should not be extended.

The methods supported by this class involve setting or getting componets of the URL name. The URL also contains a reference to a URLHandler which refers to a URLHandlerImpl which is a friend class to URL. The URLHandlerImpl implements the methods to connect to a URL and retrieve information from it.

URL()
Constructs a null URL. Uses the defaults for a null URL:" noprot", "nohost", port=-1,"/nofile" and NullURLHandler.

URL(const string& url)
Constructs this object. Uses the URLHandlerFactory to create a URLHandler for the specified protocol. The default URLHandler for files is FileURLHandlerImpl, for http is HttpURLHandlerImpl and for ldap is LdapURLHandlerImpl.
Throws:
MalformedURLException if url cannot be parsed.
Parameters:
url - string containing the url.

URL(const string& protocol, const string& host, int port, const string& file)
Constructs this object.
Parameters:
protocol - any one of these protocols - http, file or ldap
host - connect to this host
port - the port to connect to the host for sending requests
file - the information to be retrieved from the url

~URL()
Destructor

const string& getProtocol() const
Returns a string containing the protocol of this url object
Returns:
protocol component of this url

const string& getHost() const
Returns a string containing the host of this url object
Returns:
host component of this url

int getPort() const
Returns an integer containing the port of this url object
Returns:
port component of this url

const string& getFile() const
Returns a string containing the file name of the information to be retrieved from this url.
Returns:
file component of this url

string toString() const
Returns the string representation of this url. See the class description for the possible formats of URLs.
Throws:

URLConnection getURLConnection() const
Returns a URLConnection object associated with the URL. URLConnection objects provide the methods to open and close connections to the URL and read and write data through the connection.
Returns:
a URLConnection object for this URL.

operator void*() const

bool operator==(const URL& url) const

string paramString() const
Returns a string representation for URL, which is used debugging purposes.
Returns:
debugging info


This class has no child classes.
Author:
Srilekha Mudumbai Abdelilah Essiari
Version:
1.1 07/19/00
See Also:
MalformedURLException
URLHandlerImpl
FileURLHandlerImpl
URLHandlerImpl
LdapURLHandlerImpl

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de