public class DescriptiveURLs
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DescriptiveURLs.DescriptiveURLsListener |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FORCE_ORIGINAL_PORTAL |
| Constructor and Description |
|---|
DescriptiveURLs() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
cleanDescriptiveURLText(java.lang.String str,
java.util.Locale locale)
Clean the specified text for use in textual part of a descriptive URL.
|
static java.lang.String |
getDescriptiveURL(Data data,
java.util.Locale locale)
Retrieve an descriptive URL for the given Data in the given language.
|
static java.lang.String |
getDescriptiveURLText(Data data,
java.util.Locale locale)
Returns the textual part of a descriptive URL built for the given Data.
|
static Category |
getFirstDescriptiveCategory(Publication pub)
Returns the first category of the given Publication belonging to
one the root categories specified for descriptive urls.
|
static java.lang.String |
getId(javax.servlet.http.HttpServletRequest request)
Returns a
Data id computed from the URL of the requested url. |
static java.lang.String |
getId(java.lang.String path)
Returns a
Data id computed from the given
requested path (servletPath + pathInfo). |
static java.lang.String |
getLanguage(javax.servlet.http.HttpServletRequest request)
Returns a ISO-639 language code computed from the URL of the specified request.
|
static java.lang.String |
getLanguage(java.lang.String path)
Returns a ISO-639 language code extracted from the given
requested path (servletPath + pathInfo).
|
static java.lang.String |
getServletPath()
Returns the servlet path used for descriptive URL.
|
static void |
init()
Initialize or reinitialize Descriptive URLS.
|
static boolean |
isEnabled()
Check if descriptive URLs are enabled.
|
static boolean |
isLanguagePartEnabled()
Check if language part is enabled in descriptive URLs.
|
static void |
removeURLCache(Data data)
Remove the cached Descriptive URL values for the given Data.
|
public static final java.lang.String FORCE_ORIGINAL_PORTAL
public static void init()
public static boolean isEnabled()
public static boolean isLanguagePartEnabled()
public static java.lang.String getId(javax.servlet.http.HttpServletRequest request)
Data id computed from the URL of the requested url.request - the request for which we want the idpublic static java.lang.String getId(java.lang.String path)
Data id computed from the given
requested path (servletPath + pathInfo).path - the requested path relative to the webapp. That is if
an url is http://domain.tld+/contextPath+/servletPath+/pathInfo + ?querystring
the requested path would be /servletPath/pathInfo (starting slash is optionnal)public static java.lang.String getLanguage(javax.servlet.http.HttpServletRequest request)
request - the request for which we want the languagepublic static java.lang.String getLanguage(java.lang.String path)
Returns only language configured in site (cf Channel.getLanguageList(), otherwise returns null.
path - the requested path relative to the webapp. That is if
an url is http://domain.tld+/contextPath+/servletPath+/pathInfo + ?querystring
the requested path would be /servletPath/pathInfo (starting slash is optionnal)public static java.lang.String getServletPath()
public static java.lang.String getDescriptiveURL(Data data, java.util.Locale locale)
{prefix}/{id}[/text]
where
{prefix} is the servlet mapping of the DisplayServlet{id} is the id of the given Data[/text] is an optionnal textual part retrieve from
method getDescriptiveURLText(Data, Locale) if textual part
has been enabled using property descriptive-urls.text.enableddata - the Data for which create the URL (cannot be null)locale - the Locale to use for I18N and localized operations
if null, the channel locale is used Channel.getLocale()java.lang.IllegalArgumentException - if data is nullpublic static java.lang.String getDescriptiveURLText(Data data, java.util.Locale locale)
descriptive-urls.text.enabled is set to "true".data - the Data for which the URL is built.locale - the Locale to use I18N and localized operation.public static Category getFirstDescriptiveCategory(Publication pub)
pub - the publication for which we want the first Descriptive Categorypublic static java.lang.String cleanDescriptiveURLText(java.lang.String str,
java.util.Locale locale)
Current implementation applies the following operation on the specified string :
descriptive-urls.text.clean.{idx}-regex and its
corresponding replacement pattern descriptive-urls.text.clean.{idx}-replace (where {idx} is a sequential number from 1).str - the string to cleanlocale - the Locale to use I18N and localized operationpublic static void removeURLCache(Data data)
This method is automatically invoked during data update.
data - the Data for which descriptive URL have been modified and for which cache need to be removedCopyright © 2001-2017 Jalios SA. All Rights Reserved.