public interface IURLGeneratorService extends IService
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 = rid of some resource; IUriReference uriRef = ug.getResourcePageUri(PathKey.DETAILS_PAGE, rid,null); com.sapportals.htmlb.Link link = new Link("detail", "Details"); link.setReference( uriRef.toString() );To include a link to a page in an email, we need an absolute URI; proceed as follows:
RID rid = rid of some resource; IUriReference uriRef = ug.getResourcePageUri(PathKey.DETAILS_PAGE, rid,null); IHierarchicalUri uri = ug.createAbsoluteUri(uriRef); String uriString = uri.toExternalForm(); // put uriString into an email
Copyright (c) SAP AG 2002-2004
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_PREFIX |
static String |
FOLDER_USER_BRIEFCASE |
static String |
FOLDER_USER_CLIPBOARD |
static String |
FOLDER_USER_FAVORITES |
static String |
FOLDER_USER_INBOX |
static String |
FOLDER_USER_LINKS |
static String |
FOLDER_USER_QUERIES |
static String |
FOLDER_USER_SHOPPING_BASKET |
static String |
FOLDER_USER_TEMP |
static String |
FOLDER_USER_WASTEBASKET |
static String |
MIME_TYPE_PHOTO |
static String |
MIME_TYPE_RDF |
static String |
MIME_TYPE_VCARD |
static String |
URLGENERATOR_SERVICE |
Modifier and Type | Method and Description |
---|---|
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(String userId)
Deprecated.
As of Netweaver '04 SP6, replaced by
getBusinessCardUri(String, IResourceContext) |
IUriReference |
getBusinessCardUri(String userId,
IResourceContext context)
Gets the relative URI for bringing up the business card of the user
specified by
userId . |
DecodedContextURL |
getDecodedContext(String contextUrlSegment)
Decodes a given Url segment which contains context information
|
RID |
getGroupResourceRID(com.sapportals.portal.security.usermanagement.IGroup group)
Deprecated.
As of NetWeaver 7.1, replaced by
getGroupResourceRID(com.sap.security.api.IGroup) |
RID |
getGroupResourceRID(IGroup group)
Gets the RID of a collection representing the specified group.
|
RID |
getGroupResourceRID(String groupId)
Gets the RID of a collection representing the specified group.
|
IUriReference |
getImageUri(String filename)
Gets the relative URI of the image
filename . |
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).
|
RID |
getPrincipalResourceRID(IPrincipal principal)
Gets the RID of a resource representing the specified UME principal.
|
RID |
getPrincipalResourceRID(String principalId)
Gets the RID of a resource representing the specified UME principal.
|
IUriReference |
getRelativeShortUriForContext(PathKey key,
IPropertyMap variantProperties,
Map additionalProperties)
Creates a relative URI for a service specified by the
key parameter. |
IUriReference |
getRelativeUri(PathKey key)
Gets the relative URI of the path referred by
key . |
IUriReference |
getRelativeUriForContext(PathKey key,
IPropertyMap variantProperties,
Map additionalProperties)
Creates a relative URI for a service specified by the
key parameter. |
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)
Deprecated.
As of NetWeaver 7.1, replaced by
getRoleResourceRID(com.sap.security.api.IRole) |
RID |
getRoleResourceRID(IRole role)
Gets the RID of a collection representing the specified role.
|
RID |
getRoleResourceRID(String roleId)
Gets the RID of a collection representing the specified role.
|
IUriReference |
getServicePageUri(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,
String folder)
Deprecated.
As of NetWeaver 7.1, replaced by
getUserFolderRID(com.sap.security.api.IUser,String) |
RID |
getUserFolderRID(IUser user,
String folder)
Gets the RID of the specified subfolder of the user's home folder.
|
RID |
getUserHomeRID(com.sapportals.portal.security.usermanagement.IUser user)
Deprecated.
As of NetWeaver 7.1, replaced by
getUserHomeRID(com.sap.security.api.IUser) |
RID |
getUserHomeRID(IUser user)
Gets the RID of the user's home folder.
|
IUriReference |
getUsermappingPageUri(String systemId,
String successUrl,
String failureUrl,
String cancelUrl)
Gets the relative URI of the usermapping maintenance servlet.
|
RID |
getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user)
Deprecated.
As of NetWeaver 7.1, replaced by
getUserResourceRID(com.sap.security.api.IUser) |
RID |
getUserResourceRID(IUser user)
Gets the RID of a resource representing the specified user.
|
RID |
getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user,
String format)
Deprecated.
As of NetWeaver 7.1, replaced by
getUserResourceRID(com.sap.security.api.IUser,String) |
RID |
getUserResourceRID(IUser user,
String format)
Gets the RID of a resource in the specified format representing the
specified user.
|
RID |
getUserResourceRID(String userId)
Gets the RID of a resource representing the specified user.
|
RID |
getUserResourceRID(String userId,
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 . |
String |
resolvePlaceholders(String uri,
IResource resource)
Resolves all placeholders contained in
uri by their
corresponding values. |
String |
resolvePlaceholders(String uri,
IResourceContext context)
Resolves all placeholders contained in
uri by their
corresponding values. |
String |
resolveRidPlaceholders(String rid,
IResourceContext context)
Resolves all placeholders contained in
rid 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. |
getDescription, getDescription, getID
static final String URLGENERATOR_SERVICE
static final String FOLDER_USER_BRIEFCASE
static final String FOLDER_USER_CLIPBOARD
static final String FOLDER_USER_FAVORITES
static final String FOLDER_USER_INBOX
static final String FOLDER_USER_LINKS
static final String FOLDER_USER_QUERIES
static final String FOLDER_USER_TEMP
static final String FOLDER_USER_SHOPPING_BASKET
static final String FOLDER_USER_WASTEBASKET
static final String MIME_TYPE_RDF
static final String MIME_TYPE_VCARD
static final String MIME_TYPE_PHOTO
static final String CONTEXT_PREFIX
IUriReference getRelativeUriForContext(PathKey key, IPropertyMap variantProperties, Map additionalProperties) throws WcmException
key
parameter.
Variant resources can be addressed by specifying the parameter variantProperties
Optionally additional non-variant properties can be passed in additionalProperties
.
The RID of the desired resource must be appended to the resulting
IUriReference
object for obtaining an URL pointing to a valid resource.
The returned IUriReference
will not contain a protocol or
authority. key
- A PathKey denoting the desired service you would like to address (e.g. @link PathKey.CONTENT_ACCESS_PATH
).variantProperties
- An IPropertyMap
containing the variant properties thus selecting a specific physical variant. (can be null
)additionalProperties
- map A java.util.Map
containing optional additional nonvariant properties (can be null
). All elements in the map must be of type String
, otherwise an IllegalArgumentException
will be thrown during processing.WcmException
- if the requested path is not configuredIUriReference getRelativeShortUriForContext(PathKey key, IPropertyMap variantProperties, Map additionalProperties) throws WcmException
key
parameter.
Similar to method getRelativeUriForContext(PathKey, IPropertyMap, Map)
but instead of serializing
all properties into the URL itself, this method serializes the context (and the optional properties) into the database
and uses an ID for referencing the serialized context. Therefore URLs generated with this method are alot shorter.
Variant resources can be addressed by specifying the parameter variantProperties
Optionally additional non-variant properties can be passed in additionalProperties
.
The RID of the desired resource must be appended to the resulting
IUriReference
object for obtaining an URL pointing to a valid resource.
The returned IUriReference
will not contain a protocol or
authority. key
- A PathKey denoting the desired service you would like to address (e.g. PathKey.CONTENT_ACCESS_PATH
).variantProperties
- An IPropertyMap
containing the variant properties thus selecting a specific physical variant. (can be null
)additionalProperties
- A java.util.Map
containing optional additional nonvariant properties (can be null
). All elements in the map must be of type String
, otherwise an IllegalArgumentException
will be thrown during processing.WcmException
- if the requested path is not configuredDecodedContextURL getDecodedContext(String contextUrlSegment) throws WcmException
contextUrlSegment
- The Url segment to decode the context fromWcmException
- WcmExceptionIUriReference 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 questionkey
WcmException
- if the requested path is not configuredIHierarchicalUri 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 questionkey
WcmException
- if the requested path is not configuredIHierarchicalUri 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 questionkey
WcmException
- if the requested path is not configuredIHierarchicalUri 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 situationIHierarchicalUri 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 situationString getNameOfConfigfile() throws WcmException
WcmException
- if the default configuration file is not configuredIUriReference getImageUri(String filename) throws WcmException
filename
.filename
- the name of the image file (without path)WcmException
- if the image path is not configuredIUriReference getBusinessCardUri(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 configuredIUriReference getBusinessCardUri(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 configuredIUriReference 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
- RIDkey
- TBD: Description of the incoming method parameterWcmException
- if the requested path is not configuredIUriReference getServicePageUri(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 configuredIUriReference getUsermappingPageUri(String systemId, String successUrl, String failureUrl, String cancelUrl) throws WcmException
systemId
- the identifier of the system in the system landscapesuccessUrl
- StringfailureUrl
- StringcancelUrl
- StringWcmException
- if the path to the usermapping page is not configuredRID getUserHomeRID(com.sapportals.portal.security.usermanagement.IUser user) throws WcmException
getUserHomeRID(com.sap.security.api.IUser)
user
- the user whose home folder in questionWcmException
- Exception raised in failure situationRID getUserHomeRID(IUser user) throws WcmException
user
- the user whose home folder in questionWcmException
- Exception raised in failure situationRID getUserFolderRID(com.sapportals.portal.security.usermanagement.IUser user, String folder) throws WcmException
getUserFolderRID(com.sap.security.api.IUser,String)
user
- the user in questionfolder
- the desired subfolder of the user's home folder
FOLDER_*
)WcmException
- Exception raised in failure situationRID getUserFolderRID(IUser user, String folder) throws WcmException
user
- the user in questionfolder
- the desired subfolder of the user's home folder
FOLDER_*
)WcmException
- Exception raised in failure situationvoid 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)
IRidSet getPrincipalCollectionRidSet() throws WcmException
WcmException
- on errorRID getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user) throws WcmException
getUserResourceRID(com.sap.security.api.IUser)
user
- the user in questionWcmException
- on errorRID getUserResourceRID(IUser user) throws WcmException
user
- the user in questionWcmException
- on errorRID getPrincipalResourceRID(IPrincipal principal) throws WcmException
principal
- the UME princial in questionWcmException
- on errorRID getUserResourceRID(com.sapportals.portal.security.usermanagement.IUser user, String format) throws WcmException
getUserResourceRID(com.sap.security.api.IUser,String)
user
- the user in questionformat
- the desired format (one of the constants FORMAT_*
)WcmException
- on errorRID getUserResourceRID(IUser user, String format) throws WcmException
user
- the user in questionformat
- the desired format (one of the constants FORMAT_*
)WcmException
- on errorRID getUserResourceRID(String userId) throws WcmException
userId
- the identifier of the user in questionWcmException
- on errorRID getPrincipalResourceRID(String principalId) throws WcmException
principalId
- the identifier of the user in questionWcmException
- on errorRID getUserResourceRID(String userId, String format) throws WcmException
userId
- the identifier of the user in questionformat
- the desired format (one of the constants FORMAT_*
WcmException
- on errorRID getGroupResourceRID(com.sapportals.portal.security.usermanagement.IGroup group) throws WcmException
getGroupResourceRID(com.sap.security.api.IGroup)
group
- the group in questionWcmException
- on errorRID getGroupResourceRID(IGroup group) throws WcmException
group
- the group in questionWcmException
- on errorRID getGroupResourceRID(String groupId) throws WcmException
groupId
- the identifier of the group in questionWcmException
- on errorRID getRoleResourceRID(com.sapportals.portal.security.usermanagement.IRole role) throws WcmException
getRoleResourceRID(com.sap.security.api.IRole)
role
- the role in questionWcmException
- on errorRID getRoleResourceRID(IRole role) throws WcmException
role
- the role in questionWcmException
- on errorRID getRoleResourceRID(String roleId) throws WcmException
roleId
- the identifier of the role in questionWcmException
- on errorvoid 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 placeholdervoid 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 deregisteredString resolveRidPlaceholders(String rid, IResourceContext context) throws ResourceException
rid
by their
corresponding values.rid
- a String
whose placeholder should be resolvedcontext
- IResourceContextResourceException
- on errorString resolvePlaceholders(String uri, IResource resource) throws ResourceException
uri
by their
corresponding values.uri
- a String
whose placeholder should be resolvedresource
- IResourceResourceException
- on errorString resolvePlaceholders(String uri, IResourceContext context) throws ResourceException
uri
by their
corresponding values.uri
- a String
whose placeholder should be resolvedcontext
- IResourceContextResourceException
- on errorvoid 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 registeredvoid deregisterUriMapper(IUriMapper mapper)
mapper
from this IURLGeneratorService
.mapper
- the URI mapper to be deregisteredRID mapUri(IUri uri) throws WcmException
uri
- the URI to be mappednull
if mapping not possibleWcmException
- Exception raised in failure situationIUri mapRID(RID rid) throws WcmException
rid
- the RID to be mappednull
if mapping not possibleWcmException
- Exception raised in failure situationAccess Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] KMC-CM
|
[sap.com] tc/km/frwk
|
api
|
EP-KM-CM
|
[sap.com] KMC-WPC
|
[sap.com] tc/kmc/wpc/wpcfacade
|
api
|
EP-PIN-WPC-WCM
|
Copyright 2018 SAP AG Complete Copyright Notice