Interface SEOService
-
public interface SEOService
The Search Engine Optimization Service is responsible for managing the mapping between friendly URLs and their internal URL counterpart. This service defines CRUD methods, as well as methods for transforming friendly URLs to internal URLs or the other way around.- Author:
- Hallo Khaznadar, Sander Dahlberg
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
activateFriendlyURL(PageVersion pageVersion)
Deprecated.now implicitly handled bypublishFriendlyURL(PageVersion)
.void
activateFriendlyURL(MediaItemVersion mediaItemVersion)
Deprecated.now implicitly handled bypublishFriendlyURL(MediaItemVersion)
.void
createFriendlyURL(PageVersion pageVersion)
Creates a new friendly URL for the given page version.void
createFriendlyURL(PageVersion pageVersion, String alternativeURL)
Creates a new friendly URL as alternative URL for the given pageVersion with the specified alternative url.void
createFriendlyURL(ResourceInstance resourceInstance, String entityTitle)
Creates a new friendly URL for the given resource instance with the specified entity title.void
createFriendlyURL(MediaItemVersion mediaItemVersion)
Creates a new friendly URL for the given media item version.void
createFriendlyURL(MediaItemVersion mediaItemVersion, String alternativeURL)
Creates a new friendly URL as alternative URL for the given mediaItemVersion with the specified alternative url.PreviewFriendlyUrlEntity
createPreview(String url, String token, String internalUrlQS)
void
deleteFriendlyURL(int id)
Deprecated.Delete friendly URLs usingdeleteFriendlyURL(Page)
,deleteFriendlyURL(PageVersion)
,deleteFriendlyURL(MediaItem)
anddeleteFriendlyURL(ResourceInstance)
.void
deleteFriendlyURL(Page page)
Deletes all friendly URLs for the given page.void
deleteFriendlyURL(PageVersion pageVersion)
Deletes the friendly URL for the given page version.void
deleteFriendlyURL(ResourceInstance resourceInstance)
Deletes the friendly URL for the given resource instance.void
deleteFriendlyURL(MediaItem mediaItem)
Deletes the friendly URL for the given media item.void
deleteFriendlyURL(MediaItemVersion mediaItemVersion)
Deletes the friendly URL for the given media item version.List<DumpedURLEntity>
getConflictingDumpedURLEntities(String urlPath, boolean matchFullPath, int objectId)
Returns a list of dumped url entities, where each dumped url entity contains a filename and description.List<FriendlyURLEntity>
getConflictingReservedContextPaths(FriendlyURLEntity friendlyURLEntity)
Checks if there are any reserved context paths configured that conflict with the provided friendly URL entityList<FriendlyURLEntity>
getConflictingUrlEntities(String urlTitle, int webId)
If a friendly url has a sequence number it means that the base url without sequence number is already taken by another content item, db page, reserved context path, dumped page or redirect.List<FriendlyURLEntity>
getConflictingUrlEntities(FriendlyURLEntity friendlyURLEntity)
If a friendly url has a sequence number it means that the base url without sequence number is already taken by another content item, db page, reserved context path, dumped page or redirect.String
getDBPageFriendlyURL(int dbId, int typeOfPageId, String host)
Deprecated.UsegetFriendlyURL(ResourceInstance)
instead.String
getFriendlyURL(String internalURL, String host)
Returns the friendly URL given an internal URL.String
getFriendlyURL(PageVersion pageVersion)
Returns the friendly URL of the given page version.String
getFriendlyURL(PageVersion pageVersion, ResourceInstance resourceInstance)
Returns the friendly URL of the given resource instance shown on the given page version.String
getFriendlyURL(PageVersion pageVersion, MediaItemVersion mediaItemVersion)
Returns the friendly URL of the given media item version shown on the given page version.String
getFriendlyURL(ResourceInstance resourceInstance)
Deprecated.UsegetFriendlyURL(PageVersion, ResourceInstance)
instead.String
getFriendlyURL(MediaItemVersion mediaItemVersion, Website website)
Deprecated.UsegetFriendlyURL(PageVersion, MediaItemVersion)
instead.List<FriendlyURLEntity>
getFriendlyURLEntities(PageVersion pageVersion)
Returns all friendly URL entities for the given page version.List<FriendlyURLEntity>
getFriendlyURLEntities(MediaItemVersion mediaItemVersion)
Returns all friendly URL entities for the given media item version.FriendlyURLEntity
getFriendlyURLEntity(PageVersion pageVersion)
Returns the friendly URL entity for the given page version.FriendlyURLEntity
getFriendlyURLEntity(ResourceInstance resourceInstance)
Returns the friendly URL entity for the given resource instance.FriendlyURLEntity
getFriendlyURLEntity(MediaItemVersion mediaItemVersion)
Returns the friendly URL entity for the given media item version.FriendlyURLEntity
getFriendlyURLEntityForResultSet(ResultSet rs)
Transforms a result set to the correct FriendlyURLEntityString
getMediaItemBaseEntityURLTitle(int mediaItemVersionId)
Deprecated.UseFriendlyURLEntity.getBaseURLTitleEntityIdentifier()
which can be retrieved throughgetFriendlyURLEntity(MediaItemVersion)
.String
getMediaItemFriendlyURL(int mediaItemVersionId, String host)
Deprecated.UsegetFriendlyURL(MediaItemVersion, Website)
instead.String
getPageFriendlyURL(int pageVersionId, String host)
Deprecated.UsegetFriendlyURL(PageVersion)
instead.FriendlyURLEntity
getPageFriendlyURLEntityById(int id)
Returns the page friendly URL entity by the friendly URL entity's ID.String
getPageTitle(PageVersion pageVersion)
Returns the title used for generating the friendly URL for this page version.String
getPreviewURL(String url, String host, String previewToken)
Given a friendly url and a token, tries to get the corresponding preview stored in the database.String
getTargetURL(String url, String host)
Calculates the targeted internal URL given a relative friendly URL and a host name, or the current Friendly URL when given an old friendly URL, or returns an empty String when no match can be found.boolean
isFriendlyURL(String url, String host)
Checks whether the given URL is a friendly URL.boolean
isGoogleNewsIdOn(String host)
Returnstrue
if the Google News id feature is activated.void
moveFriendlyURL(Page page, Page sourceParentPage)
Handles the effect of a page move on the friendly URL of the page and all its descendant pages.String
normalizeUrlPart(String urlPart)
Removes all underscores, dashes and spaces from the given urlPart, then convert the result to lowercase.void
publishFriendlyURL(PageVersion pageVersion)
Handles the effect of a public version roll over on friendly URLs of descendant pages.void
publishFriendlyURL(ResourceInstance resourceInstance)
Handles the effect of a possible status change for a resource instance to the friendly URL of the resource instance.void
publishFriendlyURL(MediaItemVersion mediaItemVersion)
Handles the effect of a media item version roll over on the friendly URL of the media item version.String
translateTitleToFriendlyURL(String title, String host)
This method can be used to translate a URL title to a Friendly URL.String
translateTitleToURLIdentifier(String title)
Deprecated.Translation is done internally when creating a friendly URL.String
translateTitleToURLTitle(String title)
Deprecated.Translation is done internally when creating a friendly URL.void
updateAlternativePath(PageVersion pageVersion)
Updates the friendly URL for the given page version according to its alternative path.void
updateFriendlyURL(PageVersion pageVersion)
Updates the friendly URL for the given page version.void
updateFriendlyURL(ResourceInstance resourceInstance, String urlTitle)
Updates the friendly URL for the given resource instance using the given URL title.void
updateFriendlyURL(MediaItemVersion mediaItemVersion)
Updates the friendly URL for the given media item version.void
updateFriendlyURL(MediaItemVersion mediaItemVersion, String urlTitleOverrule)
Deprecated.The friendly URL of media item versions and page versions are defined to be tightly bound to a metadata field.
-
-
-
Method Detail
-
getTargetURL
String getTargetURL(String url, String host)
Calculates the targeted internal URL given a relative friendly URL and a host name, or the current Friendly URL when given an old friendly URL, or returns an empty String when no match can be found. For articles holds that if the friendly url is not live, then also an empty is returned.- Parameters:
host
- the host name.url
- The relative friendly URL for which the internal URL is requested.- Returns:
- the target URL if any can be found.
-
getPreviewURL
String getPreviewURL(String url, String host, String previewToken)
Given a friendly url and a token, tries to get the corresponding preview stored in the database. If found, returns the original incontext mode url, for which the friendly url was created. Finding the record, means the user requesting this url has permission; if the url is incorrect, or if the token is bad or expired, no result will be found.- Parameters:
url
- the friendly url of the previewhost
- the hostname of the website on which the request was madepreviewToken
- the token to access the original incontext mode url- Returns:
- the original internal url
-
isGoogleNewsIdOn
boolean isGoogleNewsIdOn(String host)
Returnstrue
if the Google News id feature is activated. This feature can be switched on or off per website, specified by one of the website's host names.Setting this value can be done through the configuration key
website_settings.friendly_url_google_news_id
.- Parameters:
host
- Host name of the website to check this configuration option.- Returns:
true
if the google_news_id for the current web initiative is checked,false
otherwise.
-
isFriendlyURL
boolean isFriendlyURL(String url, String host)
Checks whether the given URL is a friendly URL. An URL is defined to be friendly if and only if the URL ends with the friendly URL extension. The friendly URL extension can be configured separately for each website. As a host name can only be used for one website the host name parameter specifies for which website to check the friendly URL extension settings.Setting this value can be done through the configuration key
website_settings.friendly_url_extension
.- Parameters:
url
- Input URL to check whether it is a friendly URL. Can be absolute or relative.host
- Host name of the website to check its friendly URL extension for.- Returns:
true
if thewebsite_settings.friendly_url_extension
configuration setting equals the last part after the '.' in the given URL,false
otherwise.
-
createFriendlyURL
void createFriendlyURL(PageVersion pageVersion) throws FriendlyURLException
Creates a new friendly URL for the given page version. Assumes the given page version does not have a friendly URL already. If the given page version already has a friendly URL then aFriendlyURLException
is thrown. Also, the given page version must be of typePage.PAGE_TYPE
, or else anIllegalArgumentException
is thrown.Depending on which meta data field of the page version is used as input (see
getPageTitle(PageVersion)
) an entity URL is generated from it. The complete friendly URL of the page version consists of this entity URL and a path of all the parent page's friendly URLs. Only those parent pages are involved which have a page version for the same language as the given page version. Also the home page is excluded from those parent pages.Example:
Assume three pages titled Home, News and Economy. Home is the home page, News is a child of Home, and Economy is a child of News. Creating a child page of Economy results in the following call and friendly URL:mySEOService.createFriendlyURL(economyPage)
Resulting friendly URL:
/News/Economy/New-Page.htm
Try to avoid calling this method a lot at once, without changing the URL title. Each newly created version has the same default title, so they will all claim the same friendly URL. In effect sequence numbers are appended to these friendly URLs to make them unique, resulting in a bit less friendly URLs.
Also, avoid publishing the newly created version, before changing its default title. A published version does never release its current friendly URL automatically, even if it is changed afterwards.
- Parameters:
pageVersion
- Create a friendly URL for this page version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
createFriendlyURL
void createFriendlyURL(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Creates a new friendly URL for the given media item version. Assumes the given media item version does not have a friendly URL already. If the given media item version already has a friendly URL then aFriendlyURLException
is thrown.Try to avoid calling this method a lot at once, without changing the URL title. Each newly created version has the same default title, so they will all claim the same friendly URL. In effect sequence numbers are appended to these friendly URLs to make them unique, resulting in a bit less friendly URLs.
Also, avoid publishing the newly created version, before changing its default title. A published version does never release its current friendly URL automatically, even if it is changed afterwards.
- Parameters:
mediaItemVersion
- Create a friendly URL for this media item version.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
createFriendlyURL
void createFriendlyURL(MediaItemVersion mediaItemVersion, String alternativeURL) throws FriendlyURLException
Creates a new friendly URL as alternative URL for the given mediaItemVersion with the specified alternative url. If the URL already exist for another mediaItemVersion or pageVersion, -n will be added to the name of the alternative url.The alternative url can only contain the name of the alternative url. Slashes are not allowed.
Example:
myName
- Parameters:
mediaItemVersion
- Create a alternative URL for this mediaItemVersion.alternativeURL
- Use this URL as input for the alternative URL.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.- Since:
- 10.32.0
-
createFriendlyURL
void createFriendlyURL(ResourceInstance resourceInstance, String entityTitle) throws FriendlyURLException
Creates a new friendly URL for the given resource instance with the specified entity title. Assumes the given resource instance does not have a friendly URL already. If the given resource instance already has a friendly URL then aFriendlyURLException
is thrown.The entity title parameter should be an unformatted string, that is, the exact title given to the resource instance including any diacritical characters or spaces.
Example:
mySEOService.createFriendlyURL(resourceInstance, "Marco van Basten")
- Parameters:
resourceInstance
- Create a friendly URL for this resource instance.entityTitle
- Use this entity title as input for the friendly URL.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
createFriendlyURL
void createFriendlyURL(PageVersion pageVersion, String alternativeURL) throws FriendlyURLException
Creates a new friendly URL as alternative URL for the given pageVersion with the specified alternative url. If the URL already exist for another pageVersion or mediaItemVersion, -n will be added to the name of the alternative url.The alternative url should contain both the path and the name of the alternative url.
Example:
myNewContextPath/myName
- Parameters:
pageVersion
- Create a alternative URL for this pageVersion.alternativeURL
- Use this URL as input for the alternative URL.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
updateFriendlyURL
void updateFriendlyURL(PageVersion pageVersion) throws FriendlyURLException
Updates the friendly URL for the given page version. Assumes the given page version already has a friendly URL. Only has effect when the meta data field of the page version used for input has changed (seegetPageTitle(PageVersion)
).The friendly URL that is overwritten is not released, but becomes part of the history of friendly URLs of the given page version. If a website visitor requests a friendly URL from the history then the SEO application redirects to the most up-to-date friendly URL.
An exception on this is that as long as the given page version is not public (and also has never been), the friendly URL is overwritten. A page version is defined to be public whenever the work flow state of the page version is set to a public state. It is therefore good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state.
- Parameters:
pageVersion
- Update the friendly URL of this page version.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
updateFriendlyURL
void updateFriendlyURL(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Updates the friendly URL for the given media item version. Assumes the given media item version already has a friendly URL. The title field of the media item version is used as input for the friendly URL. To overrule this useupdateFriendlyURL(MediaItemVersion, String)
.The friendly URL that is overwritten is not released, but becomes part of the history of friendly URLs of the given media item version. If a website visitor requests a friendly URL from the history then the SEO application redirects to the most up-to-date friendly URL.
An exception on this is that as long as the given media item version is not public (and also has never been), the friendly URL is overwritten. A media item version is defined to be public whenever the work flow state of the media item version is set to a public state. It is therefore good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state.
- Parameters:
mediaItemVersion
- Update the friendly URL of this media item version.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
updateFriendlyURL
@Deprecated void updateFriendlyURL(MediaItemVersion mediaItemVersion, String urlTitleOverrule) throws FriendlyURLException
Deprecated.The friendly URL of media item versions and page versions are defined to be tightly bound to a metadata field. It should therefore not be possible to explicitly set one. Implicitly update it throughupdateFriendlyURL(MediaItemVersion)
.Updates the friendly URL for the given media item version using the given URL title. Assumes the given media item version already has a friendly URL. Uses the explicitly passed URL title overrule as input for generating the friendly URL.This method is deprecated as it is a work around for the
MediaItemVersion
lacking an URL title overrule field.- Parameters:
mediaItemVersion
- Update the friendly URL of this media item version.urlTitleOverrule
- The string used as input for creating the friendly URL.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
updateFriendlyURL
void updateFriendlyURL(ResourceInstance resourceInstance, String urlTitle) throws FriendlyURLException
Updates the friendly URL for the given resource instance using the given URL title. Assumes the given resource instance already has a friendly URL.- Parameters:
resourceInstance
- Update the friendly URL of this resource instance.urlTitle
- The string used as input for creating the friendly URL.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
updateAlternativePath
void updateAlternativePath(PageVersion pageVersion) throws FriendlyURLException
Updates the friendly URL for the given page version according to its alternative path. A page version can be given an explicit path, different from the path constructed from its parent pages. This alternative path is obtained byPageVersion.getAlternativeURLPath()
.If the alternative path is set to an empty string then its normal path is used.
- Parameters:
pageVersion
- Update the friendly URL of this page version.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
deleteFriendlyURL
void deleteFriendlyURL(Page page) throws FriendlyURLException
Deletes all friendly URLs for the given page. Next to each language version's current friendly URL also the complete history of friendly URLs of this page is deleted.- Parameters:
page
- Delete all friendly URLs of this page.- Throws:
FriendlyURLException
- Occurs in case the friendly URL could not be persisted.
-
deleteFriendlyURL
void deleteFriendlyURL(PageVersion pageVersion) throws FriendlyURLException
Deletes the friendly URL for the given page version. Next to the current friendly URL also the complete history of friendly URLs of this page version is deleted.- Parameters:
pageVersion
- Delete the friendly URL for this page version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
deleteFriendlyURL
void deleteFriendlyURL(MediaItem mediaItem) throws FriendlyURLException
Deletes the friendly URL for the given media item. Next to the current friendly URL also the complete history of friendly URLs of this media item is deleted.- Parameters:
mediaItem
- Delete the friendly URL for this media item.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
deleteFriendlyURL
void deleteFriendlyURL(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Deletes the friendly URL for the given media item version. Next to the current friendly URL also the complete history of friendly URLs of this media item version is deleted.- Parameters:
mediaItemVersion
- Delete the friendly URL for this media item version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
deleteFriendlyURL
void deleteFriendlyURL(ResourceInstance resourceInstance) throws FriendlyURLException
Deletes the friendly URL for the given resource instance. Next to the current friendly URL also the complete history of friendly URLs of this resource instance is deleted.- Parameters:
resourceInstance
- Delete the friendly URL for this resource instance.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
activateFriendlyURL
@Deprecated void activateFriendlyURL(PageVersion pageVersion) throws FriendlyURLException
Deprecated.now implicitly handled bypublishFriendlyURL(PageVersion)
.Activates the friendly URL of the given page version. Once a friendly URL is activated the application won't overwrite this friendly URL if it is updated throughupdateFriendlyURL(PageVersion)
. The friendly URL is only activated if the given page version is in a public state.When a friendly URL is activated a history of friendly URLs is build after subsequent updates. Maintaining this history makes it possible to keep these old friendly URLs accessible. Old URLs typically come from book marks and search engines.
It is a good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state. This avoids a lot of default title claims (see
createFriendlyURL(PageVersion)
) and a big history of friendly URLs.- Parameters:
pageVersion
- Activate the friendly URL of this page version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
activateFriendlyURL
@Deprecated void activateFriendlyURL(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Deprecated.now implicitly handled bypublishFriendlyURL(MediaItemVersion)
.Activates the friendly URL of the given media item version. Once a friendly URL is activated the application won't overwrite this friendly URL if it is updated throughupdateFriendlyURL(MediaItemVersion)
. The friendly URL is only activated if the given media item version is in a public state.When a friendly URL is activated a history of friendly URLs is build after subsequent updates. Maintaining this history makes it possible to keep these old friendly URLs accessible. Old URLs typically come from bookmarks and search engines.
It is a good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state. This avoids a lot of default title claims (see
createFriendlyURL(MediaItemVersion)
) and a big history of friendly URLs.- Parameters:
mediaItemVersion
- Activate the friendly URL of this media item version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
publishFriendlyURL
void publishFriendlyURL(PageVersion pageVersion) throws FriendlyURLException
Handles the effect of a public version roll over on friendly URLs of descendant pages. This method does not in any way alter the friendly URL of the given page version, but might for all its descendants. Makes sure that all page versions refer to the current, or if not available, planned page version.If the current version of the given page version's page is not
null
then all descendant page's friendly URLs are updated, so that the friendly URL of the given page version is substituted in their paths. If there was no current page version previously the friendly URL of the given page version in inserted in their paths. If there is no current page version now the previous friendly URL is removed from their paths.- Parameters:
pageVersion
- Publish the friendly URL of this page version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
publishFriendlyURL
void publishFriendlyURL(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Handles the effect of a media item version roll over on the friendly URL of the media item version. Makes sure that all media item versions refer to the current, or if not available, planned media item version.- Parameters:
mediaItemVersion
- Publish the friendly URL of this media item version.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
publishFriendlyURL
void publishFriendlyURL(ResourceInstance resourceInstance) throws FriendlyURLException
Handles the effect of a possible status change for a resource instance to the friendly URL of the resource instance.- Parameters:
resourceInstance
- Publish the friendly URL of this resource instance.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
moveFriendlyURL
void moveFriendlyURL(Page page, Page sourceParentPage) throws FriendlyURLException
Handles the effect of a page move on the friendly URL of the page and all its descendant pages. Assumes the move already happened, so that the source parent page must be passed in to be able to detect that a move actually happened. If the given page happens to be the home page then anIllegalArgumentException
is thrown.- Parameters:
page
- Move the friendly URL for this page.sourceParentPage
- The parent page the given page previously was a child of.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURL
String getFriendlyURL(String internalURL, String host) throws FriendlyURLException
Returns the friendly URL given an internal URL. The internal URL must at least contain theid
andlangid
components. If not or there is no friendly URL matching these components then the internal URL itself is returned. Optionally the internal URL might contain thecontentid
component for media items ordbid
andtypeofpage
components for database pages (resource instances), which are replaced by their friendly variant.The host specifies some website specific configuration settings that are applied to the friendly URL. These are:
- Friendly URL prefix (
website_settings.friendly_url_prefix
) - Google News id switch (
website_settings.friendly_url_google_news_id
); seeisGoogleNewsIdOn(String)
- Friendly URL separator (
website_settings.friendly_url_separator
) - Friendly URL extension (
website_settings.friendly_url_extension
)
Example:
Given the friendly URL mappings of '&id=41323&langid=42' on 'My News' and '&contentid=4' on 'New and improved SEO in WebManager', and given the configuration where friendly URL prefix is '/gx', the Google News id is switched on, the friendly URL separator is '-' and the friendly URL extension is '.htm' for a website with host name 'www.gxwebmanager.com':getFriendlyURL("/web/show?id=41323&langid=42&contentid=4&post=true", "www.gxwebmanager.com")
results in:/gx/My-News/004/New-and-improved-SEO-in-WebManager.htm?post=true
Note that the internal URL is allowed to be absolute. There is no validation though that the host name in an absolute internal URL matches the website of the specified host.
- Parameters:
internalURL
- The internal WebManager URL to translate to a friendly URL.host
- The host of the website to retrieve some configuration values from.- Returns:
- A friendly URL if at least the
id
andlangid
components can be replaced by friendly variants, or else the internal URL. - Throws:
FriendlyURLException
- If any access to the persistent layer failed.
- Friendly URL prefix (
-
getFriendlyURLEntity
FriendlyURLEntity getFriendlyURLEntity(PageVersion pageVersion) throws FriendlyURLException
Returns the friendly URL entity for the given page version.- Parameters:
pageVersion
- Return the friendly URL of this page version.- Returns:
- The friendly URL entity for the given page version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURLEntities
List<FriendlyURLEntity> getFriendlyURLEntities(PageVersion pageVersion) throws FriendlyURLException
Returns all friendly URL entities for the given page version.- Parameters:
pageVersion
- Return all friendly URLs of this page version.- Returns:
- List of friendly URL entities for the given page version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getPageFriendlyURLEntityById
FriendlyURLEntity getPageFriendlyURLEntityById(int id) throws FriendlyURLException
Returns the page friendly URL entity by the friendly URL entity's ID.- Parameters:
id
- Friendly URL entity ID.- Returns:
- Friendly URL entity.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURLEntity
FriendlyURLEntity getFriendlyURLEntity(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Returns the friendly URL entity for the given media item version.- Parameters:
mediaItemVersion
- Return the friendly URL of this media item version.- Returns:
- The friendly URL entity for the given media item version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURLEntities
List<FriendlyURLEntity> getFriendlyURLEntities(MediaItemVersion mediaItemVersion) throws FriendlyURLException
Returns all friendly URL entities for the given media item version.- Parameters:
mediaItemVersion
- Return all friendly URLs of this media item version.- Returns:
- List of friendly URL entities for the given media item version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.- Since:
- 10.36.0
-
getFriendlyURLEntity
FriendlyURLEntity getFriendlyURLEntity(ResourceInstance resourceInstance) throws FriendlyURLException
Returns the friendly URL entity for the given resource instance.- Parameters:
resourceInstance
- Return the friendly URL of this resource instance.- Returns:
- The friendly URL entity for the given resource instance.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURL
String getFriendlyURL(PageVersion pageVersion) throws FriendlyURLException
Returns the friendly URL of the given page version. The URL is relative starting with the friendly URL prefix and ending with the friendly URL extension. The middle part consists of a slash separated path of pages.Assuming default settings
/web
as prefix and.htm
as extension a second level page titled 'Today', with parent page named 'News' will result in the friendly URL:/web/News/Today.htm
.- Parameters:
pageVersion
- Get the friendly URL for this page version.- Returns:
- The friendly URL for the given page version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURL
String getFriendlyURL(PageVersion pageVersion, MediaItemVersion mediaItemVersion) throws FriendlyURLException
Returns the friendly URL of the given media item version shown on the given page version. The URL is relative starting with the friendly URL prefix and ending with the friendly URL extension. The middle part consists of a slash separated path of pages ending with a slash and the title of the media item version.Assuming default settings
/web
as prefix and.htm
as extension a second level page titled 'Today', with parent page named 'News' and a media item version titled 'Booming Economy'. will result in the friendly URL:/web/News/Today/BoomingEconomy.htm
.- Parameters:
pageVersion
- The friendly URL consists of a path of pages till this page version.mediaItemVersion
- Get the friendly URL for this media item version.- Returns:
- The friendly URL for the given media item version shown on the given page version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURL
@Deprecated String getFriendlyURL(ResourceInstance resourceInstance) throws FriendlyURLException
Deprecated.UsegetFriendlyURL(PageVersion, ResourceInstance)
instead.Returns the friendly URL of the given resource instance.- Parameters:
resourceInstance
- Get the friendly URL for this resource instance.- Returns:
- The friendly URL for the given resource instance.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURL
String getFriendlyURL(PageVersion pageVersion, ResourceInstance resourceInstance) throws FriendlyURLException
Returns the friendly URL of the given resource instance shown on the given page version. The URL is relative starting with the friendly URL prefix and ending with the friendly URL extension. The middle part consists of a slash separated path of pages ending with a slash and the title of the resource instance.Assuming default settings
/web
as prefix and.htm
as extension a second level page titled 'Netherlands', with parent page named 'Competitions' and a resource instance titled 'Ajax'. will result in the friendly URL:/web/Competitions/Netherlands/Ajax.htm
.- Parameters:
pageVersion
- The friendly URL consists of a path of pages till this page version.resourceInstance
- Get the friendly URL for this resource instance shown on the given page version.- Returns:
- The friendly URL for the given resource instance shown on the given page version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getFriendlyURL
@Deprecated String getFriendlyURL(MediaItemVersion mediaItemVersion, Website website) throws FriendlyURLException
Deprecated.UsegetFriendlyURL(PageVersion, MediaItemVersion)
instead.Returns the friendly URL of the given media item version.- Parameters:
mediaItemVersion
- Get the friendly URL for this media item version.website
- Use friendly URL configuration values from this website.- Returns:
- The friendly URL for the given media item version.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getPageTitle
String getPageTitle(PageVersion pageVersion)
Returns the title used for generating the friendly URL for this page version. The returned string depends on the configuration value of keywebsite_settings.friendly_url_setting
. This key can be one oftitle
,navigationtitle
orurltitle
. If left empty then the default isnavigationtitle
.- If
urltitle
is used thenPageVersion.getFriendlyURLTitle()
is used as input - If the previous input is empty and
navigationtitle
is used, then retrieve input fromPageVersion.getNavigationTitle()
- If any previous input is empty and
title
is used, then retrieve input fromContentItemVersion.getTitle()
- Parameters:
pageVersion
- Get the page title from this page version.- Returns:
- The title string used as input for generating a friendly URL for this page version.
- If
-
getPageFriendlyURL
@Deprecated String getPageFriendlyURL(int pageVersionId, String host) throws FriendlyURLException
Deprecated.UsegetFriendlyURL(PageVersion)
instead.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
pageVersionId
- Get the friendly URL for this page version id.host
- The host for which the page version id is valid.- Returns:
- The friendly URL for the given page version id.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getMediaItemFriendlyURL
@Deprecated String getMediaItemFriendlyURL(int mediaItemVersionId, String host) throws FriendlyURLException
Deprecated.UsegetFriendlyURL(MediaItemVersion, Website)
instead.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
mediaItemVersionId
- Get the friendly URL for this media item version id.host
- The host for which the media item version id is valid.- Returns:
- The friendly URL for the given media item version id.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getDBPageFriendlyURL
@Deprecated String getDBPageFriendlyURL(int dbId, int typeOfPageId, String host) throws FriendlyURLException
Deprecated.UsegetFriendlyURL(ResourceInstance)
instead.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
dbId
- Get the friendly URL for this db id and the type of page id.typeOfPageId
- Get the friendly URL for this type of page id and the db id.host
- The host for which the db id and type of page id are valid.- Returns:
- The friendly URL for the given db id and type of page id.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
getMediaItemBaseEntityURLTitle
@Deprecated String getMediaItemBaseEntityURLTitle(int mediaItemVersionId) throws FriendlyURLException
Deprecated.UseFriendlyURLEntity.getBaseURLTitleEntityIdentifier()
which can be retrieved throughgetFriendlyURLEntity(MediaItemVersion)
.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
mediaItemVersionId
- Get the base entity URL title for this media item version id.- Returns:
- The base entity URL title for this media item version id.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
translateTitleToFriendlyURL
String translateTitleToFriendlyURL(String title, String host) throws FriendlyURLException
This method can be used to translate a URL title to a Friendly URL. You can use this to calculate what the friendly url would be before theFriendlyURLEntity
is actually created. Should you which to retrieve an existing friendly url (entity) you should usegetFriendlyURL(PageVersion)
.- Parameters:
title
- Translate this title to a friendly URL.host
- Translate the title given the configuration for this host.- Returns:
- Friendly URL variant of the title.
- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
translateTitleToURLTitle
@Deprecated String translateTitleToURLTitle(String title)
Deprecated.Translation is done internally when creating a friendly URL. After that obtain the URL title throughgetFriendlyURL(PageVersion)
andFriendlyURLEntity.getURLTitle()
.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
title
- Translate this title to an URL title.- Returns:
- URL title of the title.
-
translateTitleToURLIdentifier
@Deprecated String translateTitleToURLIdentifier(String title)
Deprecated.Translation is done internally when creating a friendly URL. After that obtain the URL title throughgetFriendlyURL(PageVersion)
andFriendlyURLEntity.getURLIdentifier()
.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
title
- Translate this title to an URL identifier.- Returns:
- URL identifier of the title.
-
deleteFriendlyURL
@Deprecated void deleteFriendlyURL(int id) throws FriendlyURLException
Deprecated.Delete friendly URLs usingdeleteFriendlyURL(Page)
,deleteFriendlyURL(PageVersion)
,deleteFriendlyURL(MediaItem)
anddeleteFriendlyURL(ResourceInstance)
.DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.- Parameters:
id
- Delete the friendly URL entity with this id.- Throws:
FriendlyURLException
- If any access to the persistent layer failed.
-
createPreview
PreviewFriendlyUrlEntity createPreview(String url, String token, String internalUrlQS) throws FriendlyURLException
- Throws:
FriendlyURLException
-
getConflictingUrlEntities
List<FriendlyURLEntity> getConflictingUrlEntities(String urlTitle, int webId)
If a friendly url has a sequence number it means that the base url without sequence number is already taken by another content item, db page, reserved context path, dumped page or redirect. This method retrieves the Friendly URL entities for the original URL, without any sequence numbers.- Parameters:
urlTitle
- the url title of the friendly url- Returns:
- a list of conflicting url identifiers, or an empty list if none are found.
- Since:
- 10.36.0
-
getConflictingUrlEntities
List<FriendlyURLEntity> getConflictingUrlEntities(FriendlyURLEntity friendlyURLEntity)
If a friendly url has a sequence number it means that the base url without sequence number is already taken by another content item, db page, reserved context path, dumped page or redirect. This method retrieves the Friendly URL entities for the original URL, without any sequence numbers.- Parameters:
friendlyURLEntity
- friendly url- Returns:
- a list of conflicting url identifiers, or an empty list if none are found.
- Since:
- 10.36.0
-
getConflictingDumpedURLEntities
List<DumpedURLEntity> getConflictingDumpedURLEntities(String urlPath, boolean matchFullPath, int objectId)
Returns a list of dumped url entities, where each dumped url entity contains a filename and description. Since dumped pages are usually stored with an actual friendly URL the friendly URL of the item you want to check the conflicts for should be provided.- Parameters:
urlPath
- the actual friendly url that needs to be checked for conflicting URLsmatchFullPath
- match the complete URLobjectId
- the ID of the object being checked- Returns:
- a list of dumped url entities, or an empty list if there are none, never null.
- Since:
- 10.36.0
-
normalizeUrlPart
String normalizeUrlPart(String urlPart)
Removes all underscores, dashes and spaces from the given urlPart, then convert the result to lowercase.- Parameters:
urlPart
- holding a url part.- Returns:
- the normalized version of the given urlPart.
- Since:
- 10.36.0
-
getFriendlyURLEntityForResultSet
FriendlyURLEntity getFriendlyURLEntityForResultSet(ResultSet rs)
Transforms a result set to the correct FriendlyURLEntity- Parameters:
rs
- the resultset to transform- Returns:
- a FriendlyURLEntity
- Since:
- 10.36.0
-
getConflictingReservedContextPaths
List<FriendlyURLEntity> getConflictingReservedContextPaths(FriendlyURLEntity friendlyURLEntity)
Checks if there are any reserved context paths configured that conflict with the provided friendly URL entity- Parameters:
friendlyURLEntity
- the friendly URL entity to check versus existing reserved context paths- Returns:
- any reserved context paths that conflict with the provided friendly url entity
- Since:
- 10.36.0
-
-