net.sf.javaprinciples.resource
Interface ResourceIdentifier
public interface ResourceIdentifier
Interface encapsulating the Identifier for a Resource.
Identifiers are typically richer than a plain String, and are considered immutable.
- Author:
- rvl
getPathElements
List<String> getPathElements()
- Get the path elements from the ResourceIdentifier.
In the case of a URL, these are the elements separated by "/", with the
additional restriction that the base URL has been removed first.
That is, given a URL of http://example.com/resources/example/animals/dogs,
and a base URL of http://example.com/resources/example, the path would contain
elements "animals" and "dogs" in that order.
- Returns:
- A list of the path elements of the ResourceIdentifier that do not include
the base URL elements, and will never be null.
getQueryParameters
Map<String,String> getQueryParameters()
- Gets the query parameters associated with the ResourceIdentifier.
Query parameters are primarily used for passing parameters to algorithmic
resources.
For example, http://example.com/resources/example/animals/dogs?size=medium&fur=short
could be interpreted as a request for a list of all medium-sized dogs with short fur,
made of an algorithmic resource. The query parameters are size = medium and fur = short.
- Returns:
- The query parameters if any. The returned Map is never null.
getIdentifier
String getIdentifier()
- Gets the Identifier component of the ResourceIdentifier.
This is not to be confused with the ResourceIdentifier itself, which is the
complete URL. The Identifier in this case is by convention the last path element
in the ResourceIdentifier, and is an identifier of some "thing" as understood by
the system.
- Returns:
- The Identifier.
Copyright © 2013. All Rights Reserved.