Package lumis.portal.website
Class WebsiteUtil
- java.lang.Object
-
- lumis.portal.website.WebsiteUtil
-
public class WebsiteUtil extends 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 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 Optional<IWebsiteBaseURL>
getBestBaseURLForChannel(String channelId)
Returns the best URL for the given channel.static String
getDefaultPageWebSiteURL(HttpServletRequest request, IPortalMode portalMode)
Returns the URL to the current website with page id to the defined portal mode.static String
getId(IWebsiteBaseURL url)
Returns the identifier of the givenwebsite base URL
.static IWebsiteBaseURL
getWebsiteBaseURLById(String id)
Returns thewebsite base URL
based on its identification.static String
getWebsiteURL(HttpServletRequest request)
Returns the current WebsiteURL.static boolean
match(IWebsiteBaseURL baseUrl, String uriStr)
Checks whether the given base URL matches the given URI.static boolean
match(IWebsiteBaseURL baseUrl, URI uri)
Checks whether the given base URL matches the given URI.static IWebsiteBaseURL
resolveWebsiteBaseURLByString(String websiteStr)
Deprecated.since 10.4.0, useIWebsiteManager.getWebsiteBaseURL(URI)
instead.static IWebsite
resolveWebsiteByString(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 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(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:
IllegalArgumentException
- if the given string is a malformed URL.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(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:
IllegalArgumentException
- if the given string is a malformed URL.IllegalArgumentException
- if the protocol isn't neitherHTTP
norHTTPS
.PortalException
- Since:
- 6.2.0
-
match
public static boolean match(IWebsiteBaseURL baseUrl, 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, 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 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:
IllegalArgumentException
- if the given object isnull
.IllegalArgumentException
- if the given object's class is unknown.- Since:
- 6.2.0
-
getWebsiteBaseURLById
public static IWebsiteBaseURL getWebsiteBaseURLById(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 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 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 Optional<IWebsiteBaseURL> getBestBaseURLForChannel(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
-
-