lumis.portal.url
Class URLManager

Package class diagram package URLManager
java.lang.Object
  extended by lumis.portal.url.URLManager
All Implemented Interfaces:
IURLManager

public class URLManager
extends Object
implements IURLManager

IURLManager implementation.

Since:
5.0.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface lumis.portal.url.IURLManager
IURLManager.CreateStrategy
 
Field Summary
 
Fields inherited from interface lumis.portal.url.IURLManager
EXTENSION_HTML_PROPERTY_NAME, EXTENSION_SHTML_PROPERTY_NAME, FORCE_FIRST_PAGE_LINK_TO_CHANNEL_LINK_PROPERTY_NAME, FRIENDLY_URL_ENABLE_PROPERTY_NAME, FRIENDLY_URL_PATTERN_PROPERTY_NAME, URL_RESOLVER_PROPERTY_NAME, WEBSITE_PROPERTY_NAME
 
Constructor Summary
URLManager()
           
 
Method Summary
 void clearPageCacheReference(WebResource webResource)
          Clears the page cache reference in a web resource.
 String convertHTMLPathsToDynamicPaths(String html)
          Deprecated. 
 String convertHTMLPathsToDynamicPaths(String html, IWebsite baseWebsite)
          Replaces, in an HTML code, paths to web resources by the corresponding dynamic path.
 String fixReferencesAccordingToPath(String html, String path)
          Fixes references within an HTML according to the given path.
 WebResource getWebResourceByDynamicPath(String dynamicPath, IURLManager.CreateStrategy createStrategy)
          Returns a web resource for the given dynamic path.
 WebResource getWebResourceByDynamicPath(String dynamicPath, IURLManager.CreateStrategy createStrategy, Locale locale)
          Returns a web resource for the given dynamic path.
 String getWebResourcePathByDynamicPath(String dynamicPath, Locale locale)
          Deprecated. 
 URI getWebResourceURI(String dynamicPath, Locale locale, IWebsite baseWebsite, boolean baseSecure)
          Returns the URI for referencing a web resource given its dynamic path.
 String processHTMLDynamicPathReferences(String html)
          Deprecated. 
 String processHTMLDynamicPathReferences(String htmlContent, Locale locale, boolean convertGuestOnlyCaches)
          Deprecated. 
 String processHTMLDynamicPathReferences(String htmlContent, Locale locale, IWebsite baseWebsite, boolean baseSecure)
          Processes references to dynamic paths in a given HTML code.
 void setWebResourcesMissingData(IWebResourceFactory webResourceFactory, Collection<WebResource> webResources, boolean cacheEnabled, boolean friendlyURLEnabled)
          Sets missing data in the given web resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLManager

public URLManager()
Method Detail

getWebResourcePathByDynamicPath

@Deprecated
public String getWebResourcePathByDynamicPath(String dynamicPath,
                                                         Locale locale)
                                       throws PortalException
Deprecated. 

Description copied from interface: IURLManager
Returns the path for accessing the web resource of the given dynamic path. Uses the 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.

Specified by:
getWebResourcePathByDynamicPath in interface IURLManager
Parameters:
dynamicPath - the dynamic path.
locale - the the web resource locale.
Returns:
the path for accessing the web resource.
Throws:
PortalException

getWebResourceByDynamicPath

public WebResource getWebResourceByDynamicPath(String dynamicPath,
                                               IURLManager.CreateStrategy createStrategy)
                                        throws PortalException
Description copied from interface: IURLManager
Returns a web resource for the given dynamic path.

If the corresponding web resource already exists in the persistence, that instance is returned. Otherwise, createStrategy defines the behavior:

This method uses its own transactions.

Specified by:
getWebResourceByDynamicPath in interface IURLManager
Parameters:
dynamicPath - the dynamic path.
createStrategy - the strategy used if no web resource exists in persistence for the given dynamic path.
Returns:
the web resource.
Throws:
PortalObjectNotFoundException - if no web resource for the given dynamic path exists, and createStrategy is NEVER.
PortalException

getWebResourceByDynamicPath

public WebResource getWebResourceByDynamicPath(String dynamicPath,
                                               IURLManager.CreateStrategy createStrategy,
                                               Locale locale)
                                        throws PortalException
Description copied from interface: IURLManager
Returns a web resource for the given dynamic path.

If the corresponding web resource already exists in the persistence, that instance is returned. Otherwise, createStrategy defines the behavior:

This method uses its own transactions.

Specified by:
getWebResourceByDynamicPath in interface IURLManager
Parameters:
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.
Returns:
the web resource.
Throws:
PortalObjectNotFoundException - if no web resource for the given dynamic path exists, and createStrategy is NEVER.
PortalException

convertHTMLPathsToDynamicPaths

@Deprecated
public String convertHTMLPathsToDynamicPaths(String html)
                                      throws PortalException
Deprecated. 

Description copied from interface: IURLManager
Replaces, in an HTML code, paths to web resources by the corresponding dynamic path. If the path is absolute and it can be translated into dynamic path, it will be replaced by the relative dynamic path.

Specified by:
convertHTMLPathsToDynamicPaths in interface IURLManager
Returns:
the converted HTML code.
Throws:
PortalException

convertHTMLPathsToDynamicPaths

public String convertHTMLPathsToDynamicPaths(String html,
                                             IWebsite baseWebsite)
                                      throws PortalException
Description copied from interface: IURLManager
Replaces, in an HTML code, paths to web resources by the corresponding dynamic path. If the path is absolute and it can be translated into dynamic path, it will be replaced by the relative dynamic path.

Specified by:
convertHTMLPathsToDynamicPaths in interface IURLManager
baseWebsite - the website the HTML belongs to.
Returns:
the converted HTML code.
Throws:
PortalException

processHTMLDynamicPathReferences

@Deprecated
public String processHTMLDynamicPathReferences(String html)
                                        throws PortalException
Deprecated. 

Description copied from interface: IURLManager
Processes references to dynamic paths in a given HTML code. Generates and persists corresponding web resources information, if necessary, and replaces the dynamic paths by the proper web resource paths.

Specified by:
processHTMLDynamicPathReferences in interface IURLManager
Parameters:
html - the HTML code.
Returns:
the HTML code, with the references replaced.
Throws:
PortalException

processHTMLDynamicPathReferences

@Deprecated
public String processHTMLDynamicPathReferences(String htmlContent,
                                                          Locale locale,
                                                          boolean convertGuestOnlyCaches)
                                        throws PortalException
Deprecated. 

Description copied from interface: IURLManager
Processes references to dynamic paths in a given HTML code. Generates and persists corresponding web resources information, if necessary, and replaces the dynamic paths by the proper web resource paths.

Specified by:
processHTMLDynamicPathReferences in interface IURLManager
locale - the locale.
convertGuestOnlyCaches - if true, pages with cache enabled only for guest will also have their dynamic paths converted.
Returns:
the HTML code, with the references replaced.
Throws:
PortalException

processHTMLDynamicPathReferences

public String processHTMLDynamicPathReferences(String htmlContent,
                                               Locale locale,
                                               IWebsite baseWebsite,
                                               boolean baseSecure)
                                        throws PortalException
Description copied from interface: IURLManager
Processes references to dynamic paths in a given HTML code. Generates and persists corresponding web resources information, if necessary, and replaces the dynamic paths by the proper web resource hrefs.

Specified by:
processHTMLDynamicPathReferences in interface IURLManager
Parameters:
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.
Returns:
the HTML code, with the references replaced.
Throws:
PortalException

setWebResourcesMissingData

public void setWebResourcesMissingData(IWebResourceFactory webResourceFactory,
                                       Collection<WebResource> webResources,
                                       boolean cacheEnabled,
                                       boolean friendlyURLEnabled)
                                throws PortalException
Description copied from interface: IURLManager
Sets missing data in the given web resources.

Specified by:
setWebResourcesMissingData in interface IURLManager
Parameters:
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.
Throws:
PortalException

fixReferencesAccordingToPath

public String fixReferencesAccordingToPath(String html,
                                           String path)
                                    throws PortalException
Description copied from interface: IURLManager
Fixes references within an HTML according to the given path.

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.

Specified by:
fixReferencesAccordingToPath in interface IURLManager
Parameters:
html - the HTML content to be fixed.
path - the path.
Returns:
the original HTML with adjusted references.
Throws:
PortalException

clearPageCacheReference

public void clearPageCacheReference(WebResource webResource)
Clears the page cache reference in a web resource.

Parameters:
webResource - the web resource.
Since:
5.0.0
See Also:
WebResource.pageCache

getWebResourceURI

public URI getWebResourceURI(String dynamicPath,
                             Locale locale,
                             IWebsite baseWebsite,
                             boolean baseSecure)
                      throws PortalException
Description copied from interface: IURLManager
Returns the URI for referencing a web resource given its dynamic path.

The returned URI may be relative to the specified base website, or absolute if it is not possible to create such relative URI.

Specified by:
getWebResourceURI in interface IURLManager
Parameters:
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.
Returns:
the URI to access the specified web resource. It may be relative to the specified base website or absolute.
Throws:
PortalException


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.