public interface IURLManager
Modifier and Type | Interface and Description |
---|---|
static class |
IURLManager.CreateStrategy
Contains creation strategy options.
|
static class |
IURLManager.PathReferenceType
Used to specify how html references should be made.
|
Modifier and Type | Field and Description |
---|---|
static String |
EXTENSION_HTML_PROPERTY_NAME
Property used to indicate the extension to be used for HTML web resources.
|
static String |
EXTENSION_SHTML_PROPERTY_NAME
Property used to indicate the extension to be used for SHTML web resources.
|
static String |
FORCE_FIRST_PAGE_LINK_TO_CHANNEL_LINK_PROPERTY_NAME
Property used to indicate that links to the first page of a channel should
link to the channel web resource instead.
|
static String |
FRIENDLY_URL_ENABLE_PROPERTY_NAME
The name of the property that indicates where friendly URL is enabled.
|
static String |
FRIENDLY_URL_PATTERN_PROPERTY_NAME
The name of a default property that contains a pattern for the IURLResolver.
|
static String |
PATH_REFERENCE_TYPE_PROPERTY_NAME
Property name to define how paths should be fixed.
|
static String |
URL_RESOLVER_PROPERTY_NAME
The name of the property where the class name of the
IURLResolver
implementation is stored. |
static String |
WEBSITE_PROPERTY_NAME |
Modifier and Type | Method and Description |
---|---|
String |
convertHTMLPathsToDynamicPaths(String html)
Deprecated.
Since 6.2.0, replaced by
convertHTMLPathsToDynamicPaths(String, IWebsite)
due to the inclusion of multiple websites feature.
For best compatibility, this method resolves based on the
default website's main non-secure URL. If there is no default website,
it will throw an |
String |
convertHTMLPathsToDynamicPaths(String html,
IWebsite baseWebsite)
Deprecated.
since 8.2.0 replaced by
processHTML(String, IPageWebResourceRenderRequest) . |
String |
convertHTMLPathToDynamicPath(String href,
IWebsite baseWebsite)
Replaces the given path to web resource by the corresponding dynamic path.
|
void |
deleteWebResourceRedirection(String sourceWebsiteId,
String sourcePath)
Deletes the web resource redirection rule for the specified source website and path.
|
void |
deleteWebResourcesFromPage(String pageId)
Delete all
web resources from the page that has the given identifier. |
void |
deleteWebResourcesInChannelTree(String rootChannelId)
Delete all
web resources in the tree for which the root is the given rootChannelId . |
WebResource |
findWebResourceByPathAndWebsite(String websiteId,
String path)
Finds a web resource by it's website identifier and path.
|
String |
fixReferencesAccordingToPath(String html,
String path)
Deprecated.
since 8.2.0 replaced by
fixReferencesAccordingToPath(String, String, IPortalMode, String) |
String |
fixReferencesAccordingToPath(String html,
String path,
IPortalMode portalMode)
Deprecated.
since 8.2.0 replaced by
fixReferencesAccordingToPath(String, String, IPortalMode, String) |
String |
fixReferencesAccordingToPath(String html,
String path,
IPortalMode portalMode,
String pageId)
Fixes references within an HTML according to the given path.
|
default WebResource |
getWebResourceByDynamicPath(String dynamicPath,
IURLManager.CreateStrategy createStrategy)
Returns a web resource for the given dynamic path.
|
default WebResource |
getWebResourceByDynamicPath(String dynamicPath,
IURLManager.CreateStrategy createStrategy,
Locale locale)
Returns a web resource for the given dynamic path.
|
WebResource |
getWebResourceByDynamicPath(String dynamicPath,
IURLManager.CreateStrategy createStrategy,
Locale locale,
WebResource creator)
Returns a web resource for the given dynamic path.
|
Collection<WebResource> |
getWebResourceByParameterAndValue(String parameterName,
String parameterValue)
Get all
web resources that fits the given parameter name with the given parameter value. |
String |
getWebResourcePathByDynamicPath(String dynamicPath,
Locale locale)
Deprecated.
Since 6.2.0, due to inclusion of website feature,
the web resource path is not unique, so this method is no longer
appropriated for its original purpose of adjusting links URIs.
Consider using
getWebResourceURI(String, Locale, IWebsite, boolean) instead. |
WebResource |
getWebResourceToRedirect(String sourceWebsiteId,
String sourcePath)
Returns the web resource to redirect to when the given path on the given website is accessed.
|
default URI |
getWebResourceURI(String dynamicPath,
Locale locale,
IWebsite baseWebsite,
boolean baseSecure)
Deprecated.
The (
portal mode is now relevant and should be passed as parameter. Prefer the
method getWebResourceURI(String, Locale, IWebsite, boolean, IPortalMode) . |
default URI |
getWebResourceURI(String dynamicPath,
Locale locale,
IWebsite baseWebsite,
boolean baseSecure,
IPortalMode portalMode)
Returns the URI for referencing a web resource given its dynamic path.
|
URI |
getWebResourceURI(String dynamicPath,
Locale locale,
IWebsite baseWebsite,
boolean baseSecure,
IPortalMode portalMode,
WebResource creator)
Returns the URI for referencing a web resource given its dynamic path.
|
default String |
processHref(String url,
List<ITheme> themes,
String applicationRequestedPath,
Locale locale,
IWebsiteBaseURL websiteBaseURL,
boolean baseSecure)
Deprecated.
since 8.2.0 replaced by
processHref(String, List, String, Locale, IWebsiteBaseURL, boolean, IPortalMode) . |
default String |
processHref(String url,
List<ITheme> themes,
String applicationRequestedPath,
Locale locale,
IWebsiteBaseURL websiteBaseURL,
boolean baseSecure,
IPortalMode portalMode)
Deprecated.
|
default String |
processHref(String url,
List<ITheme> themes,
String applicationRequestedPath,
Locale locale,
IWebsiteBaseURL websiteBaseURL,
boolean baseSecure,
IPortalMode portalMode,
IURLManager.PathReferenceType pathReferenceType)
Processes a URL to be rendered correctly in a portal page.
|
String |
processHref(String url,
List<ITheme> themes,
String applicationRequestedPath,
Locale locale,
IWebsiteBaseURL websiteBaseURL,
boolean baseSecure,
IPortalMode portalMode,
IURLManager.PathReferenceType pathReferenceType,
WebResource creator)
Processes a URL to be rendered correctly in a portal page.
|
String |
processHTML(String originalHtml,
IPageWebResourceRenderRequest renderRequest)
Processes a HTML to be rendered correctly in a portal page.
|
String |
processHTML(String originalHtml,
Locale locale)
Processes a HTML to be used.
|
String |
processHTML(String originalHtml,
Locale locale,
boolean baseSecure,
IWebsiteBaseURL baseURL)
Processes a HTML to be used.
|
String |
processHTMLDynamicPathReferences(String html)
Deprecated.
Since 6.2.0, replaced by
processHTMLDynamicPathReferences(String, Locale, IWebsite, boolean)
due to the inclusion of multiple websites feature.
For best compatibility, this method resolves based on the
default website's main non-secure URL. If there is no default website,
it will throw an |
String |
processHTMLDynamicPathReferences(String htmlModifiedContent,
Locale locale,
boolean convertGuestOnlyCaches)
Deprecated.
Since 6.2.0, replaced by
processHTMLDynamicPathReferences(String, Locale, IWebsite, boolean)
due to the inclusion of multiple websites feature.
For best compatibility, this method resolves based on the
default website's main non-secure URL. If there is no default website,
it will throw an
|
String |
processHTMLDynamicPathReferences(String htmlContent,
Locale locale,
IWebsite baseWebsite,
boolean baseSecure)
Processes references to dynamic paths in a given HTML code.
|
void |
recalculateFriendlyPaths(Collection<? extends WebResource> webResources)
Calculates and updates friendly paths of the given web resources.
|
void |
recalculateFriendlyPathsInChannelTree(String rootChannelId)
Calculates and updates friendly paths of all
web resources in the tree for which the root is the given rootChannelId . |
void |
setWebResourcesMissingData(IWebResourceFactory webResourceFactory,
Collection<WebResource> webResources,
boolean cacheEnabled,
boolean friendlyURLEnabled)
Sets missing data in the given web resources.
|
static final String PATH_REFERENCE_TYPE_PROPERTY_NAME
static final String URL_RESOLVER_PROPERTY_NAME
IURLResolver
implementation is stored.static final String WEBSITE_PROPERTY_NAME
static final String FRIENDLY_URL_ENABLE_PROPERTY_NAME
static final String FRIENDLY_URL_PATTERN_PROPERTY_NAME
static final String FORCE_FIRST_PAGE_LINK_TO_CHANNEL_LINK_PROPERTY_NAME
true
.#convertFirstPagePathToChannelPath(String)
,
Constant Field Valuesstatic final String EXTENSION_HTML_PROPERTY_NAME
htmlGeneration/htmlFileExtension
specified in
lumisportalconfig.xml
.EXTENSION_SHTML_PROPERTY_NAME
,
Constant Field Valuesstatic final String EXTENSION_SHTML_PROPERTY_NAME
htmlGeneration/shtmlFileExtension
specified
in lumisportalconfig.xml
.EXTENSION_HTML_PROPERTY_NAME
,
Constant Field Values@Deprecated String getWebResourcePathByDynamicPath(String dynamicPath, Locale locale) throws PortalException
getWebResourceURI(String, Locale, IWebsite, boolean)
instead.AUTO
strategy for getting
the web resource.
The returned path may be a variant from the real web resource path, according to the dynamicPath parameters and other configurations.
dynamicPath
- the dynamic path.locale
- the the web resource locale.PortalException
@Deprecated default URI getWebResourceURI(String dynamicPath, Locale locale, IWebsite baseWebsite, boolean baseSecure) throws PortalException
portal mode
is now relevant and should be passed as parameter. Prefer the
method getWebResourceURI(String, Locale, IWebsite, boolean, IPortalMode)
.The returned URI may be relative to the specified base website, or absolute if it is not possible to create such relative URI.
dynamicPath
- the web resource's dynamic path.locale
- the web resource's locale.baseWebsite
- the website the URI is relative to (in case it is
generated as relative). May be null
if the base website is unknown.
If not specified, the returned URI will be absolute.baseSecure
- true
if the base URL for the returned URI is
secure, false
otherwise. If the web resource requires a different
secure level (HTTP or HTTPS), the URI will have to be absolute.PortalException
default URI getWebResourceURI(String dynamicPath, Locale locale, IWebsite baseWebsite, boolean baseSecure, IPortalMode portalMode) throws PortalException
The returned URI may be relative to the specified base website, or absolute if it is not possible to create such relative URI.
dynamicPath
- the web resource's dynamic path.locale
- the web resource's locale.baseWebsite
- the website the URI is relative to (in case it is generated as relative). May be null
if the
base website is unknown. If not specified, the returned URI will be absolute.baseSecure
- true
if the base URL for the returned URI is secure, false
otherwise. If the web
resource requires a different secure level (HTTP or HTTPS), the URI will have to be absolute.portalMode
- the desired IPortalMode
.PortalException
URI getWebResourceURI(String dynamicPath, Locale locale, IWebsite baseWebsite, boolean baseSecure, IPortalMode portalMode, WebResource creator) throws PortalException
The returned URI may be relative to the specified base website, or absolute if it is not possible to create such relative URI.
dynamicPath
- the web resource's dynamic path.locale
- the web resource's locale.baseWebsite
- the website the URI is relative to (in case it is generated as relative). May be null
if the
base website is unknown. If not specified, the returned URI will be absolute.baseSecure
- true
if the base URL for the returned URI is secure, false
otherwise. If the web
resource requires a different secure level (HTTP or HTTPS), the URI will have to be absolute.portalMode
- the desired IPortalMode
.PortalException
default WebResource getWebResourceByDynamicPath(String dynamicPath, IURLManager.CreateStrategy createStrategy) throws PortalException
If the corresponding web resource already exists in the persistence, that
instance is returned. Otherwise, createStrategy
defines the
behavior:
PortalObjectNotFoundException
.This method uses its own transactions.
dynamicPath
- the dynamic path.createStrategy
- the strategy used if no web resource exists in
persistence for the given dynamic path.PortalObjectNotFoundException
- if no web resource for the given
dynamic path exists, and createStrategy
is
NEVER
.IllegalArgumentException
- if the specified dynamic path could not
be resolved into a web resource.PortalException
default WebResource getWebResourceByDynamicPath(String dynamicPath, IURLManager.CreateStrategy createStrategy, Locale locale) throws PortalException
If the corresponding web resource already exists in the persistence, that
instance is returned. Otherwise, createStrategy
defines the
behavior:
PortalObjectNotFoundException
.This method uses its own transactions.
dynamicPath
- the dynamic path.createStrategy
- the strategy used if no web resource exists in
persistence for the given dynamic path.locale
- the web resource's locale.PortalObjectNotFoundException
- if no web resource for the given
dynamic path exists, and createStrategy
is
NEVER
.IllegalArgumentException
- if the specified dynamic path could not
be resolved into a web resource.PortalException
WebResource getWebResourceByDynamicPath(String dynamicPath, IURLManager.CreateStrategy createStrategy, Locale locale, WebResource creator) throws PortalException
If the corresponding web resource already exists in the persistence, that
instance is returned. Otherwise, createStrategy
defines the
behavior:
PortalObjectNotFoundException
.This method uses its own transactions.
dynamicPath
- the dynamic path.createStrategy
- the strategy used if no web resource exists in
persistence for the given dynamic path.locale
- the web resource's locale.creator
- the web resource that is requesting the given web resource (if any).PortalObjectNotFoundException
- if no web resource for the given
dynamic path exists, and createStrategy
is
NEVER
.IllegalArgumentException
- if the specified dynamic path could not
be resolved into a web resource.PortalException
@Deprecated String processHTMLDynamicPathReferences(String html) throws PortalException
processHTMLDynamicPathReferences(String, Locale, IWebsite, boolean)
due to the inclusion of multiple websites feature.
For best compatibility, this method resolves based on the
default website's main non-secure URL. If there is no default website,
it will throw an IllegalStateException
.
html
- the HTML code.PortalException
@Deprecated String convertHTMLPathsToDynamicPaths(String html) throws PortalException
convertHTMLPathsToDynamicPaths(String, IWebsite)
due to the inclusion of multiple websites feature.
For best compatibility, this method resolves based on the
default website's main non-secure URL. If there is no default website,
it will throw an IllegalStateException
.
htmlContent
- the HTML code.PortalException
@Deprecated String convertHTMLPathsToDynamicPaths(String html, IWebsite baseWebsite) throws PortalException
processHTML(String, IPageWebResourceRenderRequest)
.
If the given HTML needs to be fully processed (including path fix, web resource and themes processing) prefer
processHTML(String, IPageWebResourceRenderRequest)
instead.
htmlContent
- the HTML code.baseWebsite
- the website the HTML belongs to.PortalException
String convertHTMLPathToDynamicPath(String href, IWebsite baseWebsite) throws PortalException
href
- the path.baseWebsite
- the website the HTML belongs to.PortalException
@Deprecated String processHTMLDynamicPathReferences(String htmlModifiedContent, Locale locale, boolean convertGuestOnlyCaches) throws PortalException
processHTMLDynamicPathReferences(String, Locale, IWebsite, boolean)
due to the inclusion of multiple websites feature.
For best compatibility, this method resolves based on the
default website's main non-secure URL. If there is no default website,
it will throw an IllegalStateException
.
convertGuestOnlyCaches
parameter is no longer supported and is ignored.
htmlContent
- the HTML code.locale
- the locale.convertGuestOnlyCaches
- if true, pages with cache enabled only for
guest will also have their dynamic paths converted.PortalException
String processHTMLDynamicPathReferences(String htmlContent, Locale locale, IWebsite baseWebsite, boolean baseSecure) throws PortalException
htmlContent
- the HTML code.locale
- the locale.baseWebsite
- the website the HTML is relative to (in case it is
generated as relative). May be null
if the base website is unknown.
If not specified, the generated hrefs will be absolute.baseSecure
- true
if the base URL for the HTML is
secure, false
otherwise. If a href requires a different
secure level (HTTP or HTTPS), it will have to be absolute.PortalException
void setWebResourcesMissingData(IWebResourceFactory webResourceFactory, Collection<WebResource> webResources, boolean cacheEnabled, boolean friendlyURLEnabled) throws PortalException
webResourceFactory
- the web resource factory of the given web resources.webResources
- the web resources.cacheEnabled
- indicates that cache is enabled.friendlyURLEnabled
- indicates that friendly URL is enabled.PortalException
@Deprecated String fixReferencesAccordingToPath(String html, String path) throws PortalException
fixReferencesAccordingToPath(String, String, IPortalMode, String)
The HTML passed in to this method should be appropriate for the context root of the solution. This method changes path references in the HTML such that the references are relative to the specified path. The path must begin with the "/" character and be relative to the web application root.
html
- the HTML content to be fixed.path
- the path.PortalException
@Deprecated String fixReferencesAccordingToPath(String html, String path, IPortalMode portalMode) throws PortalException
fixReferencesAccordingToPath(String, String, IPortalMode, String)
The HTML passed in to this method should be appropriate for the context root of the solution. This method changes path references in the HTML such that the references are relative to the specified path. The path must begin with the "/" character and be relative to the web application root.
html
- the HTML content to be fixed.path
- the path.portalMode
- the current Portal Mode.PortalException
String fixReferencesAccordingToPath(String html, String path, IPortalMode portalMode, String pageId) throws PortalException
The HTML passed in to this method should be appropriate for the context root of the solution. This method changes path references in the HTML such that the references are relative to the specified path. The path must begin with the "/" character and be relative to the web application root.
html
- the HTML content to be fixed.path
- the path.portalMode
- the current Portal Mode.pageId
- the identifier of the page being rendered.PortalException
String processHTML(String originalHtml, IPageWebResourceRenderRequest renderRequest) throws PortalException
The given HTML is adjusted according with themes, relative path, web resource path translations, file download path translations and websites.
originalHtml
- the HTML to be processed.request
- the request.PortalException
String processHTML(String originalHtml, Locale locale) throws PortalException
Resources referred by the given HTML are adjusted
originalHtml
- the HTML to be processed.locale
- the locale to use for resource resolution.PortalException
String processHTML(String originalHtml, Locale locale, boolean baseSecure, IWebsiteBaseURL baseURL) throws PortalException
Resources referred by the given HTML are adjusted
originalHtml
- the HTML to be processed.locale
- the locale to use for resource resolution.baseSecure
- indicates if the process HTML should consider links to secure URLs.baseURL
- the base URL being accessed when the process is performed (if any).PortalException
@Deprecated default String processHref(String url, List<ITheme> themes, String applicationRequestedPath, Locale locale, IWebsiteBaseURL websiteBaseURL, boolean baseSecure) throws PortalException
processHref(String, List, String, Locale, IWebsiteBaseURL, boolean, IPortalMode)
.The given URL is adjusted according with themes, relative path, web resource path translations, file download path translations and websites.
The parameter applicationRequestedPath
is used to adjust the
URL to the application requested path. This method resolve path to public
files.
url
- the URL to resolve. The URL must be absolute or relative to the portal web application root. If relative, a starting '/' character is optional.themes
- list of themes to be applied to the URL.applicationRequestedPath
- the application path of the request the URL will be used in. This path is used to
adjust the URL.locale
- the locale for the URL. It is applied only if the URL does not already implies a specific locale.websiteBaseURL
- the website of the request the URL will be used in.baseSecure
- if the request the URL will be used in is secure or not.PortalException
- if any error occurs during the process.default String processHref(String url, List<ITheme> themes, String applicationRequestedPath, Locale locale, IWebsiteBaseURL websiteBaseURL, boolean baseSecure, IPortalMode portalMode, IURLManager.PathReferenceType pathReferenceType) throws PortalException
The given URL is adjusted according with themes, relative path, web resource path translations, file download path translations and websites.
The parameter applicationRequestedPath
is used to adjust the URL to the application requested path.
This method resolve path to public files.
url
- the URL to resolve. The URL must be absolute or relative to the portal web application root. If
relative, a starting '/' character is optional.themes
- list of themes to be applied to the URL.applicationRequestedPath
- the application path of the request the URL will be used in. This path is used to adjust the URL.locale
- the locale for the URL. It is applied only if the URL does not already implies a specific locale.websiteBaseURL
- the website of the request the URL will be used in.baseSecure
- if the request the URL will be used in is secure or not.portalMode
- the portal mode.pathReferenceType
- specifies how paths should be referenced.PortalException
- if any error occurs during the process.String processHref(String url, List<ITheme> themes, String applicationRequestedPath, Locale locale, IWebsiteBaseURL websiteBaseURL, boolean baseSecure, IPortalMode portalMode, IURLManager.PathReferenceType pathReferenceType, WebResource creator) throws PortalException
The given URL is adjusted according with themes, relative path, web resource path translations, file download path translations and websites.
The parameter applicationRequestedPath
is used to adjust the URL to the application requested path.
This method resolve path to public files.
url
- the URL to resolve. The URL must be absolute or relative to the portal web application root. If
relative, a starting '/' character is optional.themes
- list of themes to be applied to the URL.applicationRequestedPath
- the application path of the request the URL will be used in. This path is used to adjust the URL.locale
- the locale for the URL. It is applied only if the URL does not already implies a specific locale.websiteBaseURL
- the website of the request the URL will be used in.baseSecure
- if the request the URL will be used in is secure or not.portalMode
- the portal mode.pathReferenceType
- specifies how paths should be referenced.creator
- the web resource that is requesting the processing.PortalException
- if any error occurs during the process.@Deprecated default String processHref(String url, List<ITheme> themes, String applicationRequestedPath, Locale locale, IWebsiteBaseURL websiteBaseURL, boolean baseSecure, IPortalMode portalMode) throws PortalException
The given URL is adjusted according with themes, relative path, web resource path translations, file download path translations and websites.
The parameter applicationRequestedPath
is used to adjust the URL to the application requested path.
This method resolve path to public files.
url
- the URL to resolve. The URL must be absolute or relative to the portal web application root. If
relative, a starting '/' character is optional.themes
- list of themes to be applied to the URL.applicationRequestedPath
- the application path of the request the URL will be used in. This path is used to adjust the URL.locale
- the locale for the URL. It is applied only if the URL does not already implies a specific locale.websiteBaseURL
- the website of the request the URL will be used in.baseSecure
- if the request the URL will be used in is secure or not.portalMode
- the portal mode.PortalException
- if any error occurs during the process.WebResource findWebResourceByPathAndWebsite(String websiteId, String path) throws PortalException
websiteId
- the website identifier.path
- the path.null
if no web resource matches the given parameters.PortalException
void deleteWebResourcesInChannelTree(String rootChannelId) throws PortalException
web resources
in the tree for which the root is the given rootChannelId
.rootChannelId
- The channelId to start recursing fromPortalException
void deleteWebResourcesFromPage(String pageId) throws PortalException
web resources
from the page that has the given identifier.pageId
- The identifier of the page that has the web resources to be deletedPortalException
Collection<WebResource> getWebResourceByParameterAndValue(String parameterName, String parameterValue)
web resources
that fits the given parameter name with the given parameter value.parameterName
- a given parameter nameparameterValue
- a given parameter valueweb resources
that satisfies parameter name equals parameter value.void recalculateFriendlyPaths(Collection<? extends WebResource> webResources) throws PortalException
The original values that get updated are stored to use for redirecting to the updated ones. This redirect
information can be obtained using getWebResourceToRedirect(String, String)
.
webResources
- the web resources.PortalException
WebResource getWebResourceToRedirect(String sourceWebsiteId, String sourcePath) throws PortalException
This method uses its own transaction.
sourceWebsiteId
- the web site identifier.sourcePath
- the path, starting with '/', relative to the web site root.null
if there is no redirect information for the specified
website and path.PortalException
void deleteWebResourceRedirection(String sourceWebsiteId, String sourcePath) throws PortalException
sourceWebsiteId
- the source website identifier.sourcePath
- the source path.PortalException
void recalculateFriendlyPathsInChannelTree(String rootChannelId) throws PortalException
web resources
in the tree for which the root is the given rootChannelId
.
The original values that get updated are stored to use for redirecting to the updated ones. This redirect
information can be obtained using getWebResourceToRedirect(String, String)
.
rootChannelId
- The channelId to start recursing fromPortalException
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.