|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.cafesoft.cams.access.AbstractResourceRequest
|
+--com.cafesoft.cams.access.url.UrlResourceRequest
UrlResourceRequest represents a request for resource
identified by a Uniform Resource Locator (URL).
An UrlResourceRequest is uniquely identified by:
URLs have the general form:
scheme://host[:port]/uribut actions are generally specific to the scheme. For example, if the scheme is "http" or "https", then actions: GET, PUT, POST, DELETE, etc. are appropriate. If the scheme is "ftp" or "ftps", the actions: READ, WRITE, MKDIR, etc. are appropriate.
This class is configurable for use with many different type resources available via URL.
| Field Summary |
| Fields inherited from class com.cafesoft.cams.access.AbstractResourceRequest |
actions, actionsMask, id, type |
| Constructor Summary | |
UrlResourceRequest(Map schemeMap,
ResourceType type,
String id,
String actions)
Create a new UrlResourceRequest object. |
|
| Method Summary | |
String |
getHost()
Get the URL Resource host. |
int |
getPort()
Get the URI Resource port. |
String |
getScheme()
Get the URL Resource scheme. |
String |
getUri()
Get the Uniform Resource Indicator. |
protected void |
parseActions(String actions)
Parse the actions. |
protected void |
parseId(String id)
Parse the id. |
| Methods inherited from class com.cafesoft.cams.access.AbstractResourceRequest |
getActions, getActionsMask, getId, getResourceType, setActions, setId, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public UrlResourceRequest(Map schemeMap,
ResourceType type,
String id,
String actions)
throws InvalidResourceException
schemeMap - a Map containing all defaultPorts for all
supported Url schemes.type - the ResourceType of the ResourceRequest.id - the colloquial id of the ResourceRequest.actions - the colloquial actions of the ResourceRequest.
InvalidResourceException - if any errors occur while
creating the AbstractResourceRequest.| Method Detail |
public String getScheme()
public String getHost()
public int getPort()
public String getUri()
protected void parseId(String id)
throws InvalidResourceException
This method parses a URL of the following general form:
scheme://host:port/uri
where the scheme might include: "http" or "https" and the port may or may not be specified. The result of parsing will always be a "Fully Qualified Resource Identifier" (FQRI), in which all components of the URL are represented. For example, if the identifier passed to this method is:
http://www.myhost.com/secure/index.html
the resulting FQRI will be:
http://www.myhost.com:80/secure/index.html
The default ports for particular schemes are defined by the schemeMap that is passed into the constructor via the Factory. This schemeMap contains all supported schemes and their default ports. For example if the scheme is https the default port maybe 8443. If a valid port cannot be determined for a particular id a InvalidResourceException is thrown.Because Resource identifiers are case-sensitive and part of a URL is not, the following component of a URL rsesource identifier is converted to lower case:
scheme://host
The Uniform Resource Identifier portion may be case-sensitive depending on the Web Server, so it's case is preserved. For example, for:
HTTPS://WWW.MYHOST.COM/secure/index.html
the resulting FQRI will be:
https://www.myhost.com:443/secure/index.html
parseId in class AbstractResourceRequestid - the id to parse.
InvalidResourceException - if the id is invalid.
protected void parseActions(String actions)
throws InvalidResourceException
This method expects actions to be separated by either a comma, space, or tab character. For each parsed action it's actionMask is added to the the ResourceRequest's action mask.
parseActions in class AbstractResourceRequestactions - the actions to parse.
InvalidResourceException - if the actions is invalid.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||