Package lumis.portal.website
Class WebsiteUtil
- java.lang.Object
-
- lumis.portal.website.WebsiteUtil
-
public class WebsiteUtil extends java.lang.Object
Website utility class.- Since:
- 6.2.0
- Version:
- $Revision: 24143 $ $Date: 2020-09-14 19:21:23 -0300 (Mon, 14 Sep 2020) $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
IGNORE_FILE_ADJUST_ON_WEBSITE_CHANGE_TRANSACTION_ATTRIBUTE
Name of a transaction attribute that turn off the files adjustment when changing websites.
-
Constructor Summary
Constructors Constructor Description WebsiteUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
compareURLs(IWebsiteBaseURL firstURL, IWebsiteBaseURL secondURL)
Compares if the URLs are equalsstatic java.util.Optional<IWebsiteBaseURL>
getBestBaseURLForChannel(java.lang.String channelId)
Returns the best URL for the given channel.static java.lang.String
getDefaultPageWebSiteURL(HttpServletRequest request, IPortalMode portalMode)
Returns the URL to the current website with page id to the defined portal mode.static java.lang.String
getId(IWebsiteBaseURL url)
Returns the identifier of the givenwebsite base URL
.static IWebsiteBaseURL
getWebsiteBaseURLById(java.lang.String id)
Returns thewebsite base URL
based on its identification.static java.lang.String
getWebsiteURL(HttpServletRequest request)
Returns the current WebsiteURL.static boolean
match(IWebsiteBaseURL baseUrl, java.lang.String uriStr)
Checks whether the given base URL matches the given URI.static boolean
match(IWebsiteBaseURL baseUrl, java.net.URI uri)
Checks whether the given base URL matches the given URI.static IWebsiteBaseURL
resolveWebsiteBaseURLByString(java.lang.String websiteStr)
Deprecated.since 10.4.0, useIWebsiteManager.getWebsiteBaseURL(URI)
instead.static IWebsite
resolveWebsiteByString(java.lang.String websiteStr)
Resolves the given website string in awebsite
.
The given string will be parsed asnew URI(String)
, so that it must adhere withURI
syntax.
-
-
-
Field Detail
-
IGNORE_FILE_ADJUST_ON_WEBSITE_CHANGE_TRANSACTION_ATTRIBUTE
public static final java.lang.String IGNORE_FILE_ADJUST_ON_WEBSITE_CHANGE_TRANSACTION_ATTRIBUTE
Name of a transaction attribute that turn off the files adjustment when changing websites. This is for testing purposes only!- Since:
- 12.4.0
-
-
Method Detail
-
resolveWebsiteByString
public static IWebsite resolveWebsiteByString(java.lang.String websiteStr) throws PortalException
Resolves the given website string in awebsite
.
The given string will be parsed asnew URI(String)
, so that it must adhere withURI
syntax.- Parameters:
websiteStr
- the website string to be parsed.- Returns:
- the resolved
website
. - Throws:
java.lang.IllegalArgumentException
- if the given string is a malformed URL.java.lang.IllegalArgumentException
- if the protocol isn't neitherHTTP
norHTTPS
.PortalException
- Since:
- 6.2.0
- See Also:
resolveWebsiteBaseURLByString(String)
-
compareURLs
public static boolean compareURLs(IWebsiteBaseURL firstURL, IWebsiteBaseURL secondURL)
Compares if the URLs are equals- Parameters:
firstURL
-IWebsiteBaseURL
to be comparedsecondURL
-IWebsiteBaseURL
to be compared- Returns:
- boolean true if the urls are equals
- Since:
- 7.0.0
-
resolveWebsiteBaseURLByString
@Deprecated public static IWebsiteBaseURL resolveWebsiteBaseURLByString(java.lang.String websiteStr) throws PortalException
Deprecated.since 10.4.0, useIWebsiteManager.getWebsiteBaseURL(URI)
instead.Resolves the given website string in awebsite base URL
.
The given string will be parsed asnew URI(String)
, so that it must adhere withURI
syntax.- Parameters:
websiteStr
- the website string to be parsed.- Returns:
- the resolved
website base URL
. - Throws:
java.lang.IllegalArgumentException
- if the given string is a malformed URL.java.lang.IllegalArgumentException
- if the protocol isn't neitherHTTP
norHTTPS
.PortalException
- Since:
- 6.2.0
-
match
public static boolean match(IWebsiteBaseURL baseUrl, java.net.URI uri)
Checks whether the given base URL matches the given URI.- Parameters:
baseUrl
- the base URL.uriStr
- the URI.- Returns:
- whether the given base URL matches the given URI.
- Since:
- 10.2.0
-
match
public static boolean match(IWebsiteBaseURL baseUrl, java.lang.String uriStr)
Checks whether the given base URL matches the given URI.- Parameters:
baseUrl
- the base URL.uriStr
- the URI.- Returns:
- whether the given base URL matches the given URI.
- Since:
- 10.2.0
-
getId
public static java.lang.String getId(IWebsiteBaseURL url)
Returns the identifier of the givenwebsite base URL
.- Parameters:
url
- the website base URL.- Returns:
- the identifier of the given
website base URL
. - Throws:
java.lang.IllegalArgumentException
- if the given object isnull
.java.lang.IllegalArgumentException
- if the given object's class is unknown.- Since:
- 6.2.0
-
getWebsiteBaseURLById
public static IWebsiteBaseURL getWebsiteBaseURLById(java.lang.String id)
Returns thewebsite base URL
based on its identification.- Parameters:
id
- thewebsite base URL
identification.- Returns:
- the
website base URL
based on its identification. - Since:
- 6.2.0
-
getWebsiteURL
public static java.lang.String getWebsiteURL(HttpServletRequest request)
Returns the current WebsiteURL.- Parameters:
request
- request in which the website is situated.- Returns:
- string containing protocol://hostname : port / context. Port may be omitted if it's 80.
- Since:
- 7.0.0
-
getDefaultPageWebSiteURL
public static java.lang.String getDefaultPageWebSiteURL(HttpServletRequest request, IPortalMode portalMode) throws PortalException
Returns the URL to the current website with page id to the defined portal mode.- Parameters:
request
- from where to find website.portalMode
- value of the portal mode for the url to be generated to.- Returns:
- string containing website url.
- Throws:
PortalException
- Since:
- 7.0.0
-
getBestBaseURLForChannel
public static java.util.Optional<IWebsiteBaseURL> getBestBaseURLForChannel(java.lang.String channelId) throws PortalException
Returns the best URL for the given channel.- Parameters:
channelId
- the channel identifier- Returns:
- the best URL for the given channel.
- Throws:
PortalException
- Since:
- 12.5.0
-
-