|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Offers methods to get relative or absolute URIs pointing to certain resources of the CM system like iViews or repositories.
The URL generator service provides methods to get relative URIs (containing absolute paths without protocol and server) to certain resources like the explorer page or details page. It's recommended to use only these relative URIs as long as possible. For example, it's sufficient to use a relative URI for setting a link from one page to another page on the same server (see example below)
The interface also offers the possibility to generate absolute URIs (containing protocol and server). This feature is need, e.g., for integrating URIs into emails to allow a direct link into the CM system (see example below)
To obtain a valid instance of an URL generator, proceed as follows:
IURLGeneratorService ug = (IURLGeneratorService)ResourceFactory
.getInstance()
.getServiceFactory()
.getService(IServiceTypesConst.URLGENERATOR_SERVICE);
To set a link from one page to another on the same server, we only
need a relative URI; proceed as follows: RID rid =To include a link to a page in an email, we need an absolute URI; proceed as follows:; IUriReference uriRef = ug.getResourcePageUri(PathKey.DETAILS_PAGE, rid,null); com.sapportals.htmlb.Link link = new Link("detail", "Details"); link.setReference( uriRef.toString() );
RID rid =Copyright (c) SAP AG; IUriReference uriRef = ug.getResourcePageUri(PathKey.DETAILS_PAGE, rid,null); IHierarchicalUri uri = ug.createAbsoluteUri(uriRef); String uriString = uri.toExternalForm(); // put into an email
| Field Summary | |
static java.lang.String |
FOLDER_USER_BRIEFCASE
|
static java.lang.String |
FOLDER_USER_CLIPBOARD
|
static java.lang.String |
FOLDER_USER_FAVORITES
|
static java.lang.String |
FOLDER_USER_INBOX
|
static java.lang.String |
FOLDER_USER_LINKS
|
static java.lang.String |
FOLDER_USER_QUERIES
|
static java.lang.String |
FOLDER_USER_TEMP
|
static java.lang.String |
MIME_TYPE_PHOTO
|
static java.lang.String |
MIME_TYPE_RDF
|
static java.lang.String |
MIME_TYPE_VCARD
|
| Method Summary | |
IHierarchicalUri |
createAbsoluteUri(IUriReference relativeUri)
Creates an absolute URI out of the specified relative URI (containing an absolute path) by prepending the configured protocol, server and port. |
IHierarchicalUri |
createAlternativeAbsoluteUri(IUriReference relativeUri)
Creates an absolute URI out of the specified relative URI (containing an absolute path) by prepending the configured (alternative) protocol, server and port. |
void |
deregisterPlaceholderResolver(IPlaceholderResolver resolver)
Deregisters resolver from this IURLGeneratorService
. |
void |
deregisterUriMapper(IUriMapper mapper)
Deregisters mapper from this IURLGeneratorService
. |
IHierarchicalUri |
getAbsoluteUri(PathKey key)
Gets the absolute URI of the path referred by key . |
IHierarchicalUri |
getAlternativeAbsoluteUri(PathKey key)
Gets the absolute URI of the path referred by key . |
IUriReference |
getBusinessCardUri(java.lang.String userId)
Deprecated. As of Netweaver '04 SP6, replaced by getBusinessCardUri(String, IResourceContext) |
IUriReference |
getBusinessCardUri(java.lang.String userId,
IResourceContext context)
Gets the relative URI for bringing up the business card of the user specified by userId . |
RID |
getGroupResourceRID(com.sapportals.portal.security.usermanagement.IGroup group)
Gets the RID of a collection representing the specified group. |
RID |
getGroupResourceRID(java.lang.String groupId)
Gets the RID of a collection representing the specified group. |
IUriReference |
getImageUri(java.lang.String filename)
Gets the relative URI of the image filename . |
java.lang.String |
getNameOfConfigfile()
Returns the name of the XML file which is set as default in the CM configuration and used for the wdf-navigation. |
IRidSet |
getPrincipalCollectionRidSet()
Gets a set of RIDs of all collections representing principals (user, groups, roles). |
IUriReference |
getRelativeUri(PathKey key)
Gets the relative URI of the path referred by key . |
IUriReference |
getResourcePageUri(PathKey key,
RID resourceRID,
RID startRID)
Gets the relative URI for bringing up a page handling the resource specified by resourceRID . |
RID |
getRoleResourceRID(com.sapportals.portal.security.usermanagement.IRole role)
Gets the RID of a collection representing the specified role. |
RID |
getRoleResourceRID(java.lang.String roleId)
Gets the RID of a collection representing the specified role. |
IUriReference |
getServicePageUri(java.util.List queryParameters)
Gets the relative URI for bringing up a service which may immediately carry out some instructions (e.g. delete a resource or display a dialog). |
RID |
getUserFolderRID(com.sapportals.portal.security.usermanagement.IUser user,
java.lang.String folder)
Gets the RID of the specified subfolder of the user's home folder. |
RID |
getUserHomeRID(com.sapportals.portal.security.usermanagement.IUser user)
Gets the RID of the user's home folder. |
IUriReference |
getUsermappingPageUri(java.lang.String systemId,
java.lang.String successUrl,
java.lang.String failureUrl,
java.lang.String cancelUrl)
Gets the relative URI of the usermapping maintenance servlet. |
RID |
getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user)
Gets the RID of a resource representing the specified user. |
RID |
getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user,
java.lang.String format)
Gets the RID of a resource in the specified format representing the specified user. |
RID |
getUserResourceRID(java.lang.String userId)
Gets the RID of a resource representing the specified user. |
RID |
getUserResourceRID(java.lang.String userId,
java.lang.String format)
Gets the RID of a resource in the specified format representing the specified user. |
IUri |
mapRID(RID rid)
Gets the URI of the CM resource (e.g. http resource) represented by the given RID. |
RID |
mapUri(IUri uri)
Gets the RID of the CM resource which represents the given URI (e.g. http resource). |
void |
registerPlaceholderResolver(IPlaceholderResolver resolver)
Registers resolver to this IURLGeneratorService .
|
void |
registerUriMapper(IUriMapper mapper)
Registers mapper to this IURLGeneratorService .
|
java.lang.String |
resolvePlaceholders(java.lang.String uri,
IResource resource)
Resolves all placeholders contained in uri by their
corresponding values. |
java.lang.String |
resolvePlaceholders(java.lang.String uri,
IResourceContext context)
Resolves all placeholders contained in uri by their
corresponding values. |
void |
setUMRidGenerator(IUserManagementRidGenerator ridGenerator)
Sets ridGenerator as the new IUserManagementRidGenerator
. used by some of the methods in this interface to get RIDs of
resources representing principals (users. groups, roles) or information
about them. |
| Methods inherited from interface com.sapportals.wcm.service.IService |
getDescription, getDescription, getID |
| Field Detail |
public static final java.lang.String FOLDER_USER_BRIEFCASE
public static final java.lang.String FOLDER_USER_CLIPBOARD
public static final java.lang.String FOLDER_USER_FAVORITES
public static final java.lang.String FOLDER_USER_INBOX
public static final java.lang.String FOLDER_USER_LINKS
public static final java.lang.String FOLDER_USER_QUERIES
public static final java.lang.String FOLDER_USER_TEMP
public static final java.lang.String MIME_TYPE_RDF
public static final java.lang.String MIME_TYPE_VCARD
public static final java.lang.String MIME_TYPE_PHOTO
| Method Detail |
public IUriReference getRelativeUri(PathKey key)
throws WcmException
key . The
returned IUriReference will not contain a protocol or
authority. getRelativeUri(PathKey.EXPLORER_SERVLET) -> /wcm/apps/explorer
key - the key of the path in questionkeyWcmException - if the requested path is not configured
public IHierarchicalUri getAbsoluteUri(PathKey key)
throws WcmException
key . The
absolute URI will consist of the configured protocol, server and port
concatenated with the path in question. getAbsoluteUri(PathKey.EXPLORER_SERVLET) -> http://localhost:8080/wcm/apps/explorer
key - the key of the path in questionkeyWcmException - if the requested path is not configured
public IHierarchicalUri getAlternativeAbsoluteUri(PathKey key)
throws WcmException
key . The
absolute URI will consist of the configured (alternative) protocol, server and port
concatenated with the path in question. getAlternativeAbsoluteUri(PathKey.EXPLORER_SERVLET) -> http://server2:8080/wcm/apps/explorer
key - the key of the path in questionkeyWcmException - if the requested path is not configured
public IHierarchicalUri createAbsoluteUri(IUriReference relativeUri)
throws WcmException
IUriReference uriRef = urlGenerator.getBusinessCardUri("admin", resourceContext);
IHierarchicalUri uri = urlGenerator.createAbsoluteUri(uriRef);
relativeUri - the relative URI to be transformed into an absolute one
(must contain an absolute path)WcmException - Exception raised in failure situation
public IHierarchicalUri createAlternativeAbsoluteUri(IUriReference relativeUri)
throws WcmException
IUriReference uriRef = urlGenerator.getBusinessCardUri("admin", resourceContext);
IHierarchicalUri uri = urlGenerator.createAlternativeAbsoluteUri(uriRef);
relativeUri - the relative URI to be transformed into an absolute one
(must contain an absolute path)WcmException - Exception raised in failure situation
public java.lang.String getNameOfConfigfile()
throws WcmException
WcmException - if the default configuration file is not configured
public IUriReference getImageUri(java.lang.String filename)
throws WcmException
filename .filename - the name of the image file (without path)WcmException - if the image path is not configured
public IUriReference getBusinessCardUri(java.lang.String userId)
throws WcmException
getBusinessCardUri(String, IResourceContext)
userId .userId - the identifier of the user whose business card being
questionedWcmException - if the path of the businesscard is not configured
public IUriReference getBusinessCardUri(java.lang.String userId,
IResourceContext context)
throws WcmException
userId .userId - the identifier of the user whose business card being
questionedcontext - a resource context containing an authenticated userWcmException - if the path of the businesscard is not configured
public IUriReference getResourcePageUri(PathKey key,
RID resourceRID,
RID startRID)
throws WcmException
resourceRID . The additional parameter
startRID has to be a parent RID of the given resource RID. It
forbids navigation to any element being a root for the given resource RID.resourceRID - the RID of the resource in questionstartRID - key - TBD: Description of the incoming method parameterWcmException - if the requested path is not configured
public IUriReference getServicePageUri(java.util.List queryParameters)
throws WcmException
properties must contain parameters identifying the
service to be started and the instructions to be performed.
The interface IWcmConst holds a set of parameters starting
with SERVICE_SERVLET which can be used as keys or default
values for the parameter properties . You can also use "free"
key-value pairs, but you have to make sure, that the receiving service
knows about these keys.
Example:
Properties props = new Properties(); props.setProperty(IWcmConst.SERVICE_SERVLET_PARAMETER_RESOURCE, rid.toExternalForm()); props.setProperty(IWcmConst.SERVICE_SERVLET_PARAMETER_STARTPAGE, "WcmExplorerPage"); props.setProperty(IWcmConst.SERVICE_SERVLET_PARAMETER_XML_FILE, "WcmController.xml"); IUriReference uriRef = urlGenerator.getServletCallUri(props);
queryParameters - TBD: Description of the incoming method parameterWcmException - if the path to the service page is not configured
public IUriReference getUsermappingPageUri(java.lang.String systemId,
java.lang.String successUrl,
java.lang.String failureUrl,
java.lang.String cancelUrl)
throws WcmException
systemId - the identifier of the system in the system landscapesuccessUrl - failureUrl - cancelUrl - WcmException - if the path to the usermapping page is not configured
public RID getUserHomeRID(com.sapportals.portal.security.usermanagement.IUser user)
throws WcmException
user - the user whose home folder in questionWcmException - Exception raised in failure situation
public RID getUserFolderRID(com.sapportals.portal.security.usermanagement.IUser user,
java.lang.String folder)
throws WcmException
user - the user in questionfolder - the desired subfolder of the user's home folder
FOLDER_* )WcmException - Exception raised in failure situationpublic void setUMRidGenerator(IUserManagementRidGenerator ridGenerator)
ridGenerator as the new IUserManagementRidGenerator
. used by some of the methods in this interface to get RIDs of
resources representing principals (users. groups, roles) or information
about them. ridGenerator - the RID generator to be setgetGroupResourceRID(String),
getRoleResourceRID(String),
getUserResourceRID(String)
public IRidSet getPrincipalCollectionRidSet()
throws WcmException
WcmException - on error
public RID getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user)
throws WcmException
user - the user in questionWcmException - on error
public RID getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user,
java.lang.String format)
throws WcmException
user - the user in questionformat - the desired format (one of the constants FORMAT_*
)WcmException - on error
public RID getUserResourceRID(java.lang.String userId)
throws WcmException
userId - the identifier of the user in questionWcmException - on error
public RID getUserResourceRID(java.lang.String userId,
java.lang.String format)
throws WcmException
userId - the identifier of the user in questionformat - the desired format (one of the constants FORMAT_*
WcmException - on error
public RID getGroupResourceRID(com.sapportals.portal.security.usermanagement.IGroup group)
throws WcmException
group - the group in questionWcmException - on error
public RID getGroupResourceRID(java.lang.String groupId)
throws WcmException
groupId - the identifier of the group in questionWcmException - on error
public RID getRoleResourceRID(com.sapportals.portal.security.usermanagement.IRole role)
throws WcmException
role - the role in questionWcmException - on error
public RID getRoleResourceRID(java.lang.String roleId)
throws WcmException
roleId - the identifier of the role in questionWcmException - on error
public void registerPlaceholderResolver(IPlaceholderResolver resolver)
throws AlreadyRegisteredException
resolver to this IURLGeneratorService .
The resolver will be registered for handling the placeholder which is
returned by a call to IPlaceholderResolver.getPlaceholder().
If another resolver has already been registered for handling this placeholder, it depends on the classes of the two resolver wether an exception will be thrown or not.
If both resolver are instances of the same class, the new resolver will
replace the old one. Otherwise, an AlreadyRegisteredException
will be thrown.
resolver - the IPlaceholderResolver to be registeredAlreadyRegisteredException - if a different class has already been
registered for handling the corresponding placeholderpublic void deregisterPlaceholderResolver(IPlaceholderResolver resolver)
resolver from this IURLGeneratorService
.
If resolver is not registered for handling the placeholder
which is returned by a call to IPlaceholderResolver.getPlaceholder(),
the call to this method will be ignored.
resolver - the IPlaceholderResolver to be deregistered
public java.lang.String resolvePlaceholders(java.lang.String uri,
IResource resource)
throws ResourceException
uri by their
corresponding values.uri - a String whose placeholder should be resolvedresource - ResourceException - on error
public java.lang.String resolvePlaceholders(java.lang.String uri,
IResourceContext context)
throws ResourceException
uri by their
corresponding values.uri - a String whose placeholder should be resolvedcontext - ResourceException - on errorpublic void registerUriMapper(IUriMapper mapper)
mapper to this IURLGeneratorService .
Whenever a web resource needs to be represented as a CM resource, the method should be called which will use the registered mappers to accomplish the task of mapping a given web URL to a RID of a CM resource.
mapper - the URI mapper to be registeredpublic void deregisterUriMapper(IUriMapper mapper)
mapper from this IURLGeneratorService
.mapper - the URI mapper to be deregistered
public RID mapUri(IUri uri)
throws WcmException
uri - the URI to be mappednull
if mapping not possibleWcmException - Exception raised in failure situation
public IUri mapRID(RID rid)
throws WcmException
rid - the RID to be mappednull
if mapping not possibleWcmException - Exception raised in failure situation
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||