|
|
|
|
|
|
Modules Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members Related Pages
acdk::net::URL Class Reference#include <URL.h>
Inheritance diagram for acdk::net::URL:
List of all members.
Detailed Description
Represents a URL.
- Todo:
- integrate with acdk::io::FileSystem and acdk::io::FileImpl
|
Public Member Functions |
| URL (IN(RString) protocol, IN(RString) host, IN(RString) file) |
| Constructs a URL and loads a protocol handler for the values passed in as arugments.
|
| URL (IN(RString) protocol, IN(RString) host, int port, IN(RString) file, IN(RString) user=Nil, IN(RString) pass=Nil, IN(RURLStreamHandler) ph=Nil) |
| This method initializes a new instance of URL with the specified protocol, host, port, and file.
|
| URL (IN(RURL) context, IN(RString) url, IN(RURLStreamHandler) ph=Nil) |
| This method parses a String representation of a URL within the context of an existing URL.
|
| URL (IN(RString) url) |
| Initializes a URL from a complete string specification such as .
|
virtual RString | getProtocol () |
| Returns the protocol name of this URL.
|
virtual RString | getHost () |
| Returns the hostname or IP address for this protocol.
|
virtual int | getPort () |
| Returns the port number of this URL or -1 if the default port number is being used.
|
void | setPort (int portno) |
virtual RString | getFile () |
| Returns the portion of this URL.
|
void | setFile (IN(RString) fn) |
virtual RString | getUser () |
void | setUser (IN(RString) u) |
virtual RString | getPassword () |
void | setPassword (IN(RString) p) |
virtual RString | getRef () |
| Returns the ref (sometimes called the ) portion of the URL.
|
void | setRef (IN(RString) r) |
virtual bool | equals (IN(RObject) url) |
| Test another URL for equality with this one.
|
virtual bool | sameFile (IN(RURLInterface) url) |
| Tests whether or not another URL refers to the same as this one.
|
int | compareTo (IN(acdk::lang::Object) url) |
| compares t objects Object::compareTo() UnsupportedOperationException
|
virtual RString | toExternalForm () |
| Returns a String representing this URL.
|
virtual RString | toString () |
| Returns a String representing this URL.
|
virtual RURLConnection | openConnection () |
| Returns a URLConnection for this object created by calling the openConnection() method of the protocol handler.
|
RReader | openStream () |
| This method returns an InputStream for this URL by first opening the connection, then calling the getInputStream() method against the connection.
|
acdk::lang::Object | getContent () |
| Returns the contents of this URL as an object by first opening a connection, then calling the getContent() method against the connection.
|
virtual int | hashCode () |
| This method returns a hash value for this object.
|
Static Public Member Functions |
RString | fileAsUrlName (IN(RString) fileName) |
RString | fileAsUrlName (IN(acdk::io::RFile) file) |
Protected Member Functions |
virtual void | set (IN(RString) protocol, IN(RString) host, int port, IN(RString) user, IN(RString) password, IN(RString) file, IN(RString) ref) |
| This protected method is used by protocol handlers to set the values of the fields in this URL.
|
Private Member Functions |
void | _URLinit (IN(RString) protocol, IN(RString) host, int port, IN(RString) user, IN(RString) pass, IN(RString) file, IN(RURLStreamHandler) ph) |
void | _URLbyContext (IN(RURL) context, IN(RString) url, IN(RURLStreamHandler) ph=Nil) |
Private Attributes |
RString | protocol |
RString | host |
int | port |
RString | file |
RString | ref |
| The # portion of the URL.
|
RString | user |
RString | password |
RURLStreamHandler | ph |
Friends |
class | URLStreamHandler |
class | URL_initializer |
Constructor & Destructor Documentation
|
Constructs a URL and loads a protocol handler for the values passed in as arugments.
Uses the default port for the protocol.
- Parameters:
-
protocol | The protocol for this URL (, , etc) |
host | The hostname or IP address for this URL |
file | The portion of this URL. |
- Exceptions:
-
MalformedURLException | If a protocol handler cannot be loaded |
|
acdk::net::URL::URL |
( |
IN(RString) |
protocol, |
|
|
IN(RString) |
host, |
|
|
int |
port, |
|
|
IN(RString) |
file, |
|
|
IN(RString) |
user = Nil, |
|
|
IN(RString) |
pass = Nil, |
|
|
IN(RURLStreamHandler) |
ph = Nil |
|
) |
[inline] |
|
|
This method initializes a new instance of URL with the specified protocol, host, port, and file.
Additionally, this method allows the caller to specify a protocol handler to use instead of the default. If this handler is specified, the caller must have the permission (see NetPermission ) or a SecurityException will be thrown.
- Parameters:
-
protocol | The protocol for this URL (, , etc) |
host | The hostname or IP address to connect to |
port | The port number to use, or -1 to use the protocol's default port |
file | The portion of the URL. |
ph | The protocol handler to use with this URL. |
- Exceptions:
-
MalformedURLException | If no protocol handler can be loaded for the specified protocol. |
SecurityException | If the SecurityManager exists and does not allow the caller to specify its own protocol handler. |
|
acdk::net::URL::URL |
( |
IN(RURL) |
context, |
|
|
IN(RString) |
url, |
|
|
IN(RURLStreamHandler) |
ph = Nil |
|
) |
[inline] |
|
|
This method parses a String representation of a URL within the context of an existing URL.
Principally this means that any fields not present the URL are inheritied from the context URL. This allows relative URL's to be easily constructed (***true?***). If the context argument is null, then a complete URL must be specified in the URL string. If the protocol parsed out of the URL is different from the context URL's protocol, then then URL String is also expected to be a complete URL.
Additionally, this method allows the caller to specify a protocol handler to use instead of the default. If this handler is specified, the caller must have the permission (see NetPermission ) or a SecurityException will be thrown.
- Parameters:
-
context | The context URL |
url | A String representing this URL |
ph | The protocol handler for this URL |
- Exceptions:
-
MalformedURLException | If a protocol handler cannot be found or the URL cannot be parsed |
SecurityException | If the SecurityManager exists and does not allow the caller to specify its own protocol handler. |
|
acdk::net::URL::URL |
( |
IN(RString) |
url |
) |
[inline] |
|
|
Initializes a URL from a complete string specification such as .
First the protocol name is parsed out of the string. Then a handler is located for that protocol and the parseURL() method of that protocol handler is used to parse the remaining fields.
- Parameters:
-
url | The complete String representation of a URL |
- Exceptions:
-
MalformedURLException | If a protocol handler cannot be found or the URL cannot be parsed |
|
Member Function Documentation
void acdk::net::URL::_URLbyContext |
( |
IN(RURL) |
context, |
|
|
IN(RString) |
url, |
|
|
IN(RURLStreamHandler) |
ph = Nil |
|
) |
[private] |
|
void acdk::net::URL::_URLinit |
( |
IN(RString) |
protocol, |
|
|
IN(RString) |
host, |
|
|
int |
port, |
|
|
IN(RString) |
user, |
|
|
IN(RString) |
pass, |
|
|
IN(RString) |
file, |
|
|
IN(RURLStreamHandler) |
ph |
|
) |
[private] |
|
int acdk::net::URL::compareTo |
( |
IN(RObject) |
url |
) |
[inline, virtual] |
|
|
compares t objects Object::compareTo() UnsupportedOperationException
- Returns:
- 0 if equal 1 if this object is greater, -1 if ohter
- Exceptions:
-
UnsupportedOperationException | |
Reimplemented from acdk::lang::Object. |
virtual bool acdk::net::URL::equals |
( |
IN(RObject) |
url |
) |
[virtual] |
|
|
Test another URL for equality with this one.
This will be true only if the argument is non-null and all of the fields in the URL's match exactly (ie, protocol, host, port, file, and ref). Overrides Object.equals().
- Parameters:
-
url | The URL to compare with |
- Returns:
- true if the URL is equal, false otherwise
Reimplemented from acdk::lang::Object. |
RString acdk::net::URL::fileAsUrlName |
( |
IN(acdk::io::RFile) |
file |
) |
[static] |
|
RString acdk::net::URL::fileAsUrlName |
( |
IN(RString) |
fileName |
) |
[static] |
|
RObject acdk::net::URL::getContent |
( |
|
) |
[virtual] |
|
|
Returns the contents of this URL as an object by first opening a connection, then calling the getContent() method against the connection.
- Returns:
- A content object for this URL
- Exceptions:
-
IOException | If an error occurs |
Implements acdk::net::URLInterface. |
virtual RString acdk::net::URL::getFile |
( |
|
) |
[inline, virtual] |
|
virtual RString acdk::net::URL::getHost |
( |
|
) |
[inline, virtual] |
|
virtual RString acdk::net::URL::getPassword |
( |
|
) |
[inline, virtual] |
|
virtual int acdk::net::URL::getPort |
( |
|
) |
[inline, virtual] |
|
|
Returns the port number of this URL or -1 if the default port number is being used.
- Returns:
- The port number
Implements acdk::net::URLInterface. |
virtual RString acdk::net::URL::getProtocol |
( |
|
) |
[inline, virtual] |
|
virtual RString acdk::net::URL::getRef |
( |
|
) |
[inline, virtual] |
|
virtual RString acdk::net::URL::getUser |
( |
|
) |
[inline, virtual] |
|
virtual int acdk::net::URL::hashCode |
( |
|
) |
[inline, virtual] |
|
|
This method returns a hash value for this object.
- Returns:
- a hash value for this object.
Reimplemented from acdk::lang::Object. |
virtual RURLConnection acdk::net::URL::openConnection |
( |
|
) |
[virtual] |
|
RReader acdk::net::URL::openStream |
( |
|
) |
[virtual] |
|
|
This method returns an InputStream for this URL by first opening the connection, then calling the getInputStream() method against the connection.
- Returns:
- An InputStream for this URL
- Exceptions:
-
IOException | If an error occurs |
Implements acdk::net::URLInterface. |
virtual bool acdk::net::URL::sameFile |
( |
IN(RURLInterface) |
url |
) |
[virtual] |
|
|
Tests whether or not another URL refers to the same as this one.
This will be true if and only if the passed object is not null, is a URL, and matches all fields but the ref (ie, protocol, host, port, and file);
- Parameters:
-
url | The URL object to test with |
- Returns:
- true if URL matches this URL's file, false otherwise
Implements acdk::net::URLInterface. |
|
This protected method is used by protocol handlers to set the values of the fields in this URL.
This might be done in the parseURL method of that class.
- Parameters:
-
protocol | The protocol name for this URL |
host | The hostname or IP address for this URL |
port | The port number of this URL |
file | The portion of this URL. |
ref | The anchor portion of this URL. |
|
void acdk::net::URL::setFile |
( |
IN(RString) |
fn |
) |
[inline] |
|
void acdk::net::URL::setPassword |
( |
IN(RString) |
p |
) |
[inline] |
|
void acdk::net::URL::setPort |
( |
int |
portno |
) |
[inline] |
|
void acdk::net::URL::setRef |
( |
IN(RString) |
r |
) |
[inline] |
|
void acdk::net::URL::setUser |
( |
IN(RString) |
u |
) |
[inline] |
|
virtual RString acdk::net::URL::toExternalForm |
( |
|
) |
[virtual] |
|
virtual RString acdk::net::URL::toString |
( |
|
) |
[inline, virtual] |
|
|
Returns a String representing this URL.
Identical to toExternalForm(). The value returned is created by the protocol handler's toExternalForm method. Overrides Object.toString()
- Returns:
- A string for this URL
Reimplemented from acdk::lang::Object. |
Friends And Related Function Documentation
friend class URL_initializer [friend]
|
|
Member Data Documentation
|
The # portion of the URL.
|
| |