|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.link.LinkUtil
public class LinkUtil
Utility methods for various operations necessary for link transformations and handling.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_EXTENSION
|
static java.lang.String |
DEFAULT_REPOSITORY
|
static java.util.regex.Pattern |
EXTERNAL_LINK_PATTERN
Pattern that matches external and mailto: links. |
static java.util.regex.Pattern |
LINK_OR_IMAGE_PATTERN
Pattern to find a link. |
Constructor Summary | |
---|---|
LinkUtil()
|
Method Summary | |
---|---|
static void |
addParameter(java.lang.StringBuffer uri,
java.lang.String name,
java.lang.String value)
Appends a parameter to the given url, using ?, or & if there are already parameters in the given url. |
static java.lang.String |
convertAbsoluteLinksToUUIDs(java.lang.String html)
Parses provided html and transforms all the links to the magnolia format. |
static java.lang.String |
convertLinksFromUUIDPattern(java.lang.String str)
|
static java.lang.String |
convertLinksFromUUIDPattern(java.lang.String str,
LinkTransformer transformer)
Converts provided html with links in UUID pattern format to any other kind of links based on provided link transformer. |
static java.lang.String |
convertUUIDtoHandle(java.lang.String uuid,
java.lang.String repository)
Transforms a uuid to a handle beginning with a /. |
static java.lang.String |
convertUUIDtoURI(java.lang.String uuid,
java.lang.String repository)
Transforms a uuid to an uri. |
static java.lang.String |
createAbsoluteLink(Content content)
Creates absolute link including context path to the provided content and performing all URI2Repository mappings and applying locales. |
static java.lang.String |
createAbsoluteLink(NodeData nodedata)
Creates absolute link including context path for provided node data. |
static java.lang.String |
createAbsoluteLink(java.lang.String repository,
java.lang.String uuid)
Creates absolute link including context path to the provided content and performing all URI2Repository mappings and applying locales. |
static java.lang.String |
createExternalLink(Content content)
Creates a complete url to access given content from external systems applying all the URI2Repository mappings and locales. |
static java.lang.String |
createLink(Content node)
Creates link guessing best possible link format from current site and provided node. |
static java.lang.String |
createLink(NodeData nodedata)
Creates link guessing best possible link format from current site and provided node data. |
static java.lang.String |
createLink(java.lang.String repository,
java.lang.String uuid)
Creates link guessing best possible link format from current site and provided content. |
static boolean |
isExternalLinkOrAnchor(java.lang.String href)
Determines whether the given link is external link or anchor (i.e. |
static boolean |
isInternalRelativeLink(java.lang.String href)
Determines if the given link is internal and relative. |
static java.lang.String |
makePathRelative(java.lang.String url,
java.lang.String absolutePath)
Make a absolute path relative. |
static java.lang.String |
mapPathToRepository(java.lang.String path)
Maps a path to a repository. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.regex.Pattern EXTERNAL_LINK_PATTERN
public static final java.lang.String DEFAULT_EXTENSION
public static final java.lang.String DEFAULT_REPOSITORY
public static final java.util.regex.Pattern LINK_OR_IMAGE_PATTERN
Constructor Detail |
---|
public LinkUtil()
Method Detail |
---|
public static java.lang.String convertUUIDtoHandle(java.lang.String uuid, java.lang.String repository) throws LinkException
LinkException
public static java.lang.String convertUUIDtoURI(java.lang.String uuid, java.lang.String repository) throws LinkException
Link.getHandle()
,
this method will apply all uri to repository mappings as well as i18n.
LinkException
public static java.lang.String convertAbsoluteLinksToUUIDs(java.lang.String html)
html
- html code with links to be converted
public static java.lang.String convertLinksFromUUIDPattern(java.lang.String str, LinkTransformer transformer) throws LinkException
str
- Html with UUID linkstransformer
- Link transformer
LinkException
LinkTransformerManager
public static java.lang.String convertLinksFromUUIDPattern(java.lang.String str) throws LinkException
LinkException
public static boolean isInternalRelativeLink(java.lang.String href)
public static boolean isExternalLinkOrAnchor(java.lang.String href)
public static java.lang.String makePathRelative(java.lang.String url, java.lang.String absolutePath)
absolutePath
- absolute pathurl
- page to be relative to
public static java.lang.String mapPathToRepository(java.lang.String path)
path
- URI
public static void addParameter(java.lang.StringBuffer uri, java.lang.String name, java.lang.String value)
public static java.lang.String createAbsoluteLink(NodeData nodedata) throws LinkException
nodedata
- Node data to create link for.
LinkException
AbstractI18nContentSupport
public static java.lang.String createAbsoluteLink(java.lang.String repository, java.lang.String uuid) throws javax.jcr.RepositoryException
uuid
- UUID of content to create link to.repository
- Name of the repository where content is located.
javax.jcr.RepositoryException
AbstractI18nContentSupport
public static java.lang.String createAbsoluteLink(Content content)
content
- content to create link to.
AbstractI18nContentSupport
public static java.lang.String createExternalLink(Content content)
content
-
public static java.lang.String createLink(Content node)
nodedata
- Node data to create link for.
AbstractI18nContentSupport
public static java.lang.String createLink(NodeData nodedata) throws LinkException
nodedata
- Node data to create link for.
LinkException
AbstractI18nContentSupport
public static java.lang.String createLink(java.lang.String repository, java.lang.String uuid) throws javax.jcr.RepositoryException
uuid
- UUID of content to create link to.repository
- Name of the repository where content is located.
javax.jcr.RepositoryException
AbstractI18nContentSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |