|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.kernel.URLService
Supports generically locating a domain object on the site. The URLService can produce the path (relative to the root URL) to a page that displays the domain object identified by a given OID.
The service works by delegating to a URLFinder based on the object type of the given OID. A URLFinder must be registered with the URLService for the object type in question or one of its supertypes. That URLFinder dynamically produces a URL path by a process that potentially involves a few database queries.
The URLService is only intended for single-object lookups. On pages that display many objects (for example, a search results page), the URLs displayed for each object should not be obtained from the URLService (for performance reasons). Instead, a single "redirector page" should be the target of all those links. The user clicks on a link, which then uses the URLService to find the object's URL and redirect the user to the resulting URL. An example of this process is:
GenericURLFinder
Field Summary | |
static String |
versionId
|
Constructor Summary | |
URLService()
|
Method Summary | |
static URLFinder |
getFinder(ObjectType objectType)
Gets the registered or inherited URLFinder for the specified object type. |
static URLFinder |
getFinder(String objectType)
|
static URLFinder |
getRegisteredFinder(ObjectType objectType)
Returns the URLFinder registered for the given object type. |
static URLFinder |
getRegisteredFinder(String objectType)
Returns the URLFinder registered for the given object type. |
static String |
locate(OID oid)
Returns a URL path to a page that displays the object identified by the given oid. |
static String |
locate(OID oid,
String context)
Returns a URL path to a page that displays the object identified by the given oid. |
static URLFinder |
registerFinder(ObjectType objectType,
URLFinder finder)
Registers a URLFinder for the specified data object type. |
static URLFinder |
registerFinder(String objectType,
URLFinder finder)
Wrapper around registerFinder(ObjectType, URLFinder). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public URLService()
Method Detail |
public static String locate(OID oid) throws URLFinderNotFoundException, NoValidURLException
URLFinderNotFoundException
- when there is no URLFinder
registered for the given oid's object type nor any of its
supertypes.
NoValidURLException
- when the
URLFinder registered for the given oid's object type is unable
to produce a valid non-null URL.public static String locate(OID oid, String context) throws URLFinderNotFoundException, NoValidURLException
URLFinderNotFoundException
- when there is no URLFinder
registered for the given oid's object type nor any of its
supertypes.
NoValidURLException
- when the
URLFinder registered for the given oid's object type is unable
to produce a valid non-null URL.public static URLFinder registerFinder(ObjectType objectType, URLFinder finder)
locate(x)
is executed, the specified
finder will be used if the specified
dataObjectType is equal to x.getObjectType()
.
Any object type that does not have a finder registered with this service is not supported by this service.
If another finder was already registered for the specified object type, the previous finder is replaced and returned.
objectType
- the data object type for which to register
the specified finderfinder
- the URLFinder that will handle data objects
of the specified data object type when the
locate method is called
public static URLFinder registerFinder(String objectType, URLFinder finder)
registerFinder(ObjectType, URLFinder)
public static URLFinder getRegisteredFinder(ObjectType objectType)
public static URLFinder getRegisteredFinder(String objectType)
public static URLFinder getFinder(ObjectType objectType)
objectType
- the object type whose registered or inherited
URLFinder is to be returned
public static URLFinder getFinder(String objectType)
getFinder(ObjectType)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |