|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.staticexport.CmsLinkManager
public class CmsLinkManager
Does the link replacement for the ≶link> tags.
Since this functionality is closely related to the static export, this class resides in the static export package.
Constructor Summary | |
---|---|
CmsLinkManager()
Public constructor. |
Method Summary | |
---|---|
static java.lang.String |
getAbsoluteUri(java.lang.String relativeUri,
java.lang.String baseUri)
Calculates the absolute uri for the "relativeUri" with the given absolute "baseUri" as start. |
java.lang.String |
getOnlineLink(CmsObject cms,
java.lang.String resourceName)
Returns the online link for the given resource. |
java.lang.String |
getPermalink(CmsObject cms,
java.lang.String resourceName)
Returns the perma link for the given resource. |
CmsExternalLinksValidationResult |
getPointerLinkValidationResult()
Returns the result of the last extern link validation. |
static java.lang.String |
getRelativeUri(java.lang.String fromUri,
java.lang.String toUri)
Calculates a realtive uri from "fromUri" to "toUri", both uri's must be absolute. |
static java.lang.String |
getSitePath(CmsObject cms,
java.lang.String relativePath,
java.lang.String targetUri)
Returns the site path for a given uri. |
void |
setPointerLinkValidationResult(CmsExternalLinksValidationResult externLinkValidationResult)
Sets the result of a extern link validation. |
java.lang.String |
substituteLink(CmsObject cms,
java.lang.String link)
Substitutes the contents of a link by adding the context path and servlet name, and in the case of the "online" project also according to the configured static export settings. |
java.lang.String |
substituteLink(CmsObject cms,
java.lang.String link,
java.lang.String siteRoot)
Substitutes the contents of a link by adding the context path and servlet name, and in the case of the "online" project also according to the configured static export settings. |
java.lang.String |
substituteLink(CmsObject cms,
java.lang.String link,
java.lang.String siteRoot,
boolean forceSecure)
Substitutes the contents of a link by adding the context path and servlet name, and in the case of the "online" project also according to the configured static export settings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmsLinkManager()
Method Detail |
---|
public static java.lang.String getAbsoluteUri(java.lang.String relativeUri, java.lang.String baseUri)
If "relativeUri" is already absolute, it is returned unchanged. This method also returns "relativeUri" unchanged if it is not well-formed.
relativeUri
- the relative uri to calculate an absolute uri forbaseUri
- the base uri, this must be an absolute uri
public static java.lang.String getRelativeUri(java.lang.String fromUri, java.lang.String toUri)
fromUri
- the uri to starttoUri
- the uri to calculate a relative path to
public static java.lang.String getSitePath(CmsObject cms, java.lang.String relativePath, java.lang.String targetUri)
If the uri contains no site information, but starts with the opencms context, the context is removed.
/opencms/opencms/system/further_path -> /system/further_path
If the uri contains no site information, the path will be prefixed with the current site
(if mysite is the site currently selected in the workplace or in the request).
/folder/page.html -> /sites/mysite/folder/page.htmlIf the path of the uri is relative, i.e. does not start with "/", the path will be prefixed with the current site and the given relative path, then normalized. If no relative path is given, null is returned. If the normalized path is outsite a site, null is returned.
page.html -> /sites/mysite/{relativePath}/page.html ../page.html -> /sites/mysite/page.html ../../page.html -> nullIf the uri contains a scheme/server name that denotes an opencms site, it is replaced by the appropriate site path.
http://www.mysite.de/folder/page.html -> /sites/mysite/folder/page.htmlIf the uri contains a scheme/server name that does not match with any site, or if the uri is opaque or invalid, null is returned.
http://www.elsewhere.com/page.html -> null mailto:someone@elsewhere.com -> null
cms
- the cms objectrelativePath
- path to use as prefix if neccessarytargetUri
- the target uri
public java.lang.String getOnlineLink(CmsObject cms, java.lang.String resourceName)
Like
http://site.enterprise.com:8080/index.html
.
cms
- the cms contextresourceName
- the resource to generate the online link for
public java.lang.String getPermalink(CmsObject cms, java.lang.String resourceName)
Like
http://site.enterprise.com:8080/permalink/4b65369f-1266-11db-8360-bf0f6fbae1f8.html
.
cms
- the cms contextresourceName
- the resource to generate the perma link for
public CmsExternalLinksValidationResult getPointerLinkValidationResult()
public void setPointerLinkValidationResult(CmsExternalLinksValidationResult externLinkValidationResult)
externLinkValidationResult
- the result a extern link validationpublic java.lang.String substituteLink(CmsObject cms, java.lang.String link)
cms
- the cms contextlink
- the link to process (must be a valid link to a VFS resource with optional parameters)
public java.lang.String substituteLink(CmsObject cms, java.lang.String link, java.lang.String siteRoot)
A server prefix is prepended if
cms
- the cms contextlink
- the link to process (must be a valid link to a VFS resource with optional parameters)siteRoot
- the site root of the link
public java.lang.String substituteLink(CmsObject cms, java.lang.String link, java.lang.String siteRoot, boolean forceSecure)
A server prefix is prepended if
cms
- the cms contextlink
- the link to process (must be a valid link to a VFS resource with optional parameters)siteRoot
- the site root of the linkforceSecure
- if true
generates always an absolute url (with protocoll and server name) for secure links
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |