|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.DescriptiveURLs
public class DescriptiveURLs
Manages Descriptive URLs production and decoding.
Nested Class Summary | |
---|---|
static class |
DescriptiveURLs.DescriptiveURLsListener
|
Constructor Summary | |
---|---|
DescriptiveURLs()
|
Method Summary | |
---|---|
static String |
cleanDescriptiveURLText(String str,
Locale locale)
Apply the following operation on the given string: unaccentuate lowercase (using given Locale) replace whitespace with "-" remove characters matching pattern [^0-9a-zA-Z/-] remove multiple contiguous letters [/-] |
static String |
getDescriptiveURL(Data data,
Locale locale)
Retrieve an descriptive URL for the given Data in the given language. |
static String |
getDescriptiveURLText(Data data,
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 String |
getId(javax.servlet.http.HttpServletRequest request)
Returns a Data id computed from the URL of the requested url. |
static String |
getId(String path)
Returns a Data id computed from the given
requested path (servletPath + pathInfo). |
static String |
getLanguage(javax.servlet.http.HttpServletRequest request)
Returns a ISO-639 language code computed from the URL of the specified request. |
static String |
getLanguage(String path)
Returns a ISO-639 language code extracted from the given requested path (servletPath + pathInfo). |
static 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 void |
removeURLCache(Data data)
Remove the cached Descriptive URL values for the given Data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DescriptiveURLs()
Method Detail |
---|
public static void init()
public static boolean isEnabled()
public static 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 id
public static String getId(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 String getLanguage(javax.servlet.http.HttpServletRequest request)
request
- the request for which we want the language
public static String getLanguage(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 String getServletPath()
public static String getDescriptiveURL(Data data, 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.enabled
data
- 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()
IllegalArgumentException
- if data is nullpublic static String getDescriptiveURLText(Data data, 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 Category
public static String cleanDescriptiveURLText(String str, Locale locale)
str
- the string to cleanlocale
- the Locale
to use I18N and localized operation
public 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 removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |