|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.gx.webmanager.services.seo.util.SEOUtil
public final class SEOUtil
Provides utilities method for the rest of the SEO bundle classes.
| Method Summary | |
|---|---|
static java.lang.String |
addSeperatedParts(java.lang.String[] parts)
|
static java.lang.String |
constructDBEntityOnPageRedirect(java.lang.String prefix,
java.lang.String pageRedirectPart,
java.lang.String dbEntityRedirectPart,
java.lang.String extension)
|
static java.lang.String |
constructItemOnPageRedirect(java.lang.String prefix,
java.lang.String pageRedirectPart,
java.lang.String itemRedirectPart,
java.lang.String googleId,
java.lang.String extension)
|
static java.lang.String |
constructPageRedirect(java.lang.String prefix,
java.lang.String redirectPart,
java.lang.String extension)
|
static java.lang.String |
ensureEndsWithPathSeparator(java.lang.String source)
Makes sure the given string ends with the path separator, if not empty. |
static java.lang.String |
extractFullPagePart(java.lang.String urlPart,
java.lang.String prefix,
java.lang.String extension)
|
static java.lang.String |
extractLastPart(java.lang.String urlPart,
java.lang.String extension)
Returns the part of the given friendlyURL between the last / and the given extension. |
static java.lang.String |
extractLastPath(java.lang.String urlPath)
Extracts the last path element from the given URL path. |
static void |
extractPageOfArticleParts(java.lang.String url,
java.lang.String prefix,
java.lang.String extension,
java.lang.String article,
java.lang.StringBuffer initialPage,
java.lang.StringBuffer googleIdORPage)
Extracts the potential page parts of a URL containing an article as the last part of the URL. |
static java.lang.String |
extractPageOfDbPagePart(java.lang.String url,
java.lang.String prefix,
java.lang.String extension,
java.lang.String dbpageEntity)
|
static java.util.regex.Pattern |
getAbsoluteHostnamePattern()
Returns a pattern for matching that part of an URL which makes it absolute. |
static java.lang.String |
getDatabasePageComponentQueryString(java.lang.String internalURL)
Returns the database page component of the given URL. |
static FriendlyURLException |
getFURLException(java.util.logging.Logger log,
java.lang.String message,
java.lang.Exception cause,
java.lang.String methodName)
Logs and throws an FriendlyURLException. |
static java.lang.IllegalArgumentException |
getIllegalArgException(java.util.logging.Logger log,
java.lang.String methodName)
Logs and throws an IllegalArgumentException with message Null argument. |
static java.lang.IllegalArgumentException |
getIllegalArgException(java.util.logging.Logger log,
java.lang.String message,
java.lang.String methodName)
Logs and throws an IllegalArgumentException. |
static java.lang.String |
getMediaItemComponentQueryString(java.lang.String internalURL)
Returns the media item component of the given URL. |
static java.lang.String |
getPageComponentQueryString(java.lang.String internalURL)
Returns the page component of the given URL. |
static java.lang.String |
getPathSeparator()
Returns the friendly URL path separator. |
static java.lang.String |
getRealURLTitle(InternalSEOService seoService,
Page page,
Language language)
Returns URL path a child of the given page in the given language would get. |
static java.lang.String |
getRealURLTitle(InternalSEOService seoService,
PageVersion pageVersion)
Returns the URL title of the given page version. |
static java.lang.String |
getRealURLTitlePath(InternalSEOService seoService,
Page page,
Language language)
Returns the URL title path of the given page and language combination. |
static java.util.regex.Pattern |
getURLSlashPattern()
Returns a pattern for matching slashes in a relative URL. |
static boolean |
hasDatabasePageComponent(java.lang.String internalURL)
Returns true if the given URL has a database page component, false otherwise. |
static boolean |
hasMediaItemComponent(java.lang.String internalURL)
Returns true if the given URL has a media item component, false otherwise. |
static boolean |
isFriendlyURL(java.lang.String url,
java.lang.String extension)
Returns true if given URL ends with given extension. |
static long |
logEntering(java.util.logging.Logger log,
java.lang.String methodName,
java.lang.Object... params)
Logs a method entering message. |
static void |
logExiting(java.util.logging.Logger log,
java.lang.String methodName,
long start)
Logs a method exiting message. |
static void |
logFiner(java.util.logging.Logger log,
java.lang.String methodName,
java.lang.String message,
java.lang.Object param)
Logs a message through the given log on level FINER. |
static void |
logFiner(java.util.logging.Logger log,
java.lang.String methodName,
java.lang.String message,
java.lang.Object[] params)
Logs a message through the given log on level FINER. |
static java.lang.String |
normalizeURLPart(java.lang.String urlPart)
Removes all underscores, dashes and spaces from the given urlPart, then convert the result to lowercase. |
static void |
reInitializeMediaItemVersion(MediaItemVersion mediaItemVersion)
Re-initializes the given media item version, so that changes to the underlying data structure of the object are visible through its getters. |
static java.lang.String |
retrieveRemainingComponents(java.lang.String completeQS,
java.lang.String extraQS)
Removes all query string components from the completeQS parameter that presents part of a
friendly URL. |
static java.lang.String |
translateEntityTitleToURLId(java.lang.String entityTitle)
Translates the given entity title to a friendly URL identifier. |
static java.lang.String |
translateEntityTitleToURLTitle(java.lang.String entityTitle)
Translates the given entity title to a friendly URL title. |
static java.lang.String |
translateURLTitleToFriendlyURL(java.lang.String urlTitle,
SEOConfig.FriendlyURLSeparator friendlyURLSeparator)
Translates an URL title to a friendly URL. |
static java.lang.String |
translateURLTitleToURLId(java.lang.String urlTitle)
Translates an URL title to an URL identifier. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String getPathSeparator()
public static java.util.regex.Pattern getAbsoluteHostnamePattern()
public static java.util.regex.Pattern getURLSlashPattern()
public static java.lang.String translateEntityTitleToURLTitle(java.lang.String entityTitle)
entityTitle - Title of an entity to be translated to a friendly URL title.
public static java.lang.String normalizeURLPart(java.lang.String urlPart)
urlPart - holding a url part.
public static java.lang.String translateEntityTitleToURLId(java.lang.String entityTitle)
entityTitle - Title of an entity to be translated to a friendly URL identifier.
public static java.lang.String translateURLTitleToURLId(java.lang.String urlTitle)
urlTitle - The URL title of a friendly URL.
public static boolean isFriendlyURL(java.lang.String url,
java.lang.String extension)
true if given URL ends with given extension.
url - to be examined as friendly or notextension - the last part of the give url must end with this extension in order to be friendly.
true if given url ends with given extension, otherwise false.
public static java.lang.String extractLastPart(java.lang.String urlPart,
java.lang.String extension)
urlPart - the friendly URLextension - the friendly URL extension
public static java.lang.String extractFullPagePart(java.lang.String urlPart,
java.lang.String prefix,
java.lang.String extension)
urlPart - prefix - extension -
public static void extractPageOfArticleParts(java.lang.String url,
java.lang.String prefix,
java.lang.String extension,
java.lang.String article,
java.lang.StringBuffer initialPage,
java.lang.StringBuffer googleIdORPage)
the extracted page parts will be appended to the passed initialPage and googleIdORPage parameters.
Examples:
example1:
given the following parameters values
example2:
given the following parameters values
example3:
given the following parameters values
url - Full URL holding at least an article and a potential page parts.prefix - The configured prefix for friendly urls.extension - The configured extension for the friendly urls.article - The article part of the given url, the url must end with this part followed by the
extension.initialPage - Will be filled by the initial page part if any (see examples).googleIdORPage - Will be filled by a page part that can be a potential googleId.
public static java.lang.String extractPageOfDbPagePart(java.lang.String url,
java.lang.String prefix,
java.lang.String extension,
java.lang.String dbpageEntity)
url - prefix - extension - dbpageEntity -
public static java.lang.String addSeperatedParts(java.lang.String[] parts)
parts -
public static java.lang.String constructPageRedirect(java.lang.String prefix,
java.lang.String redirectPart,
java.lang.String extension)
prefix - redirectPart - extension -
public static java.lang.String constructItemOnPageRedirect(java.lang.String prefix,
java.lang.String pageRedirectPart,
java.lang.String itemRedirectPart,
java.lang.String googleId,
java.lang.String extension)
prefix - pageRedirectPart - itemRedirectPart - googleId - extension -
public static java.lang.String constructDBEntityOnPageRedirect(java.lang.String prefix,
java.lang.String pageRedirectPart,
java.lang.String dbEntityRedirectPart,
java.lang.String extension)
public static boolean hasMediaItemComponent(java.lang.String internalURL)
true if the given URL has a media item component, false otherwise.
internalURL - URL to check.
true if the given URL has a media item component, false otherwise.public static boolean hasDatabasePageComponent(java.lang.String internalURL)
true if the given URL has a database page component, false otherwise.
internalURL - URL to check.
true if the given URL has a database page component, false otherwise.public static java.lang.String getPageComponentQueryString(java.lang.String internalURL)
IllegalArgumentException is thrown.
internalURL - URL to check.
public static java.lang.String getMediaItemComponentQueryString(java.lang.String internalURL)
internalURL - URL to check.
public static java.lang.String getDatabasePageComponentQueryString(java.lang.String internalURL)
internalURL - URL to check.
public static java.lang.String retrieveRemainingComponents(java.lang.String completeQS,
java.lang.String extraQS)
completeQS parameter that presents part of a
friendly URL. Returns the remaining query string components, so that they can be added to an URL. The
extraQS parameter is simply added to the remaining query string components. These are
typically friendly URL components that due to some error couldn't be transformed to a friendly URL.
If not an empty string the return value starts with a question mark, followed by the query string components concatenated with ampersands.
completeQS - Query string part of an internal URL.extraQS - Extra query string part to be added to the result.
public static java.lang.String translateURLTitleToFriendlyURL(java.lang.String urlTitle,
SEOConfig.FriendlyURLSeparator friendlyURLSeparator)
urlTitle - URL title to translate.friendlyURLSeparator - The friendly URL separator to use in the friendly URL.
public static void reInitializeMediaItemVersion(MediaItemVersion mediaItemVersion)
mediaItemVersion - Media item version to re-initialize.public static java.lang.String extractLastPath(java.lang.String urlPath)
extractLastPath("/aa/bb/cc") results in cc being returned.
urlPath - URL path.
public static java.lang.String getRealURLTitle(InternalSEOService seoService,
Page page,
Language language)
throws FriendlyURLException
seoService - Reference to the SEO service.page - Page to return the URL title for if it is current.language - Assemble a path in this language.
FriendlyURLException - If any access to the persistent layer failed.
public static java.lang.String getRealURLTitle(InternalSEOService seoService,
PageVersion pageVersion)
throws FriendlyURLException
seoService - Reference to the SEO service.pageVersion - Get the URL title of this page version.
FriendlyURLException - If any access to the persistent layer failed.
public static java.lang.String getRealURLTitlePath(InternalSEOService seoService,
Page page,
Language language)
throws FriendlyURLException
seoService - Reference to the SEO service.page - Get the URL title path to this page (thus this page is not included).language - Get the URL title path for this language.
FriendlyURLException - If any access to the persistent layer failed.
public static long logEntering(java.util.logging.Logger log,
java.lang.String methodName,
java.lang.Object... params)
log - The logger to log the message to.methodName - Name of the method being entered.params - Method's parameters.
public static void logExiting(java.util.logging.Logger log,
java.lang.String methodName,
long start)
log - The logger to log the message to.methodName - Name of the method being exited.start - Typically the current time in milliseconds when the method was entered.
public static void logFiner(java.util.logging.Logger log,
java.lang.String methodName,
java.lang.String message,
java.lang.Object param)
log - Log to this logger.methodName - Name of method that executes this method.message - Log message.param - Parameter used in the log message.
public static void logFiner(java.util.logging.Logger log,
java.lang.String methodName,
java.lang.String message,
java.lang.Object[] params)
log - Log to this logger.methodName - Name of method that executes this method.message - Log message.params - Parameters used in the log message.
public static java.lang.IllegalArgumentException getIllegalArgException(java.util.logging.Logger log,
java.lang.String methodName)
IllegalArgumentException with message Null argument.
log - Logger to log exception on.methodName - Method name in which the exception is thrown.
IllegalArgumentException
public static java.lang.IllegalArgumentException getIllegalArgException(java.util.logging.Logger log,
java.lang.String message,
java.lang.String methodName)
IllegalArgumentException.
log - Logger to log exception on.message - Exception message.methodName - Method name in which the exception is thrown.
IllegalArgumentException
public static FriendlyURLException getFURLException(java.util.logging.Logger log,
java.lang.String message,
java.lang.Exception cause,
java.lang.String methodName)
throws FriendlyURLException
FriendlyURLException.
log - Logger to log exception on.message - Exception message.cause - Exception cause.methodName - Method name in which the exception is thrown.
FriendlyURLException
FriendlyURLException - The thrown exception.public static java.lang.String ensureEndsWithPathSeparator(java.lang.String source)
source - Source string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||