|
||||||||||
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 String |
DEFAULT_EXTENSION
|
static String |
DEFAULT_REPOSITORY
|
static Pattern |
EXTERNAL_LINK_PATTERN
Pattern that matches external and mailto: links. |
static Pattern |
LINK_OR_IMAGE_PATTERN
Pattern to find a link. |
Constructor Summary | |
---|---|
LinkUtil()
|
Method Summary | |
---|---|
static void |
addParameter(StringBuffer uri,
String name,
String value)
Appends a parameter to the given url, using ?, or & if there are already parameters in the given url. |
static String |
convertAbsoluteLinksToUUIDs(String html)
Parses provided html and transforms all the links to the magnolia format. |
static String |
convertLinksFromUUIDPattern(String str)
|
static String |
convertLinksFromUUIDPattern(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 String |
convertUUIDtoHandle(String uuid,
String repository)
Transforms a uuid to a handle beginning with a /. |
static String |
convertUUIDtoURI(String uuid,
String repository)
Transforms a uuid to an uri. |
static String |
createAbsoluteLink(Content content)
Creates absolute link including context path to the provided content and performing all URI2Repository mappings and applying locales. |
static String |
createAbsoluteLink(NodeData nodedata)
Creates absolute link including context path for provided node data. |
static String |
createAbsoluteLink(String repository,
String uuid)
Creates absolute link including context path to the provided content and performing all URI2Repository mappings and applying locales. |
static String |
createExternalLink(Content content)
Creates a complete url to access given content from external systems applying all the URI2Repository mappings and locales. |
static String |
createLink(Content node)
Creates link guessing best possible link format from current site and provided node. |
static String |
createLink(NodeData nodedata)
Creates link guessing best possible link format from current site and provided node data. |
static String |
createLink(String repository,
String uuid)
Creates link guessing best possible link format from current site and provided content. |
static boolean |
isExternalLinkOrAnchor(String href)
Determines whether the given link is external link or anchor (i.e. |
static boolean |
isInternalRelativeLink(String href)
Determines if the given link is internal and relative. |
static String |
makePathRelative(String url,
String absolutePath)
Make a absolute path relative. |
static String |
mapPathToRepository(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 Pattern EXTERNAL_LINK_PATTERN
public static final String DEFAULT_EXTENSION
public static final String DEFAULT_REPOSITORY
public static final Pattern LINK_OR_IMAGE_PATTERN
Constructor Detail |
---|
public LinkUtil()
Method Detail |
---|
public static String convertUUIDtoHandle(String uuid, String repository) throws LinkException
LinkException
public static String convertUUIDtoURI(String uuid, String repository) throws LinkException
Link.getHandle()
,
this method will apply all uri to repository mappings as well as i18n.
LinkException
public static String convertAbsoluteLinksToUUIDs(String html)
html
- html code with links to be converted
public static String convertLinksFromUUIDPattern(String str, LinkTransformer transformer) throws LinkException
str
- Html with UUID linkstransformer
- Link transformer
LinkException
LinkTransformerManager
public static String convertLinksFromUUIDPattern(String str) throws LinkException
LinkException
public static boolean isInternalRelativeLink(String href)
public static boolean isExternalLinkOrAnchor(String href)
public static String makePathRelative(String url, String absolutePath)
absolutePath
- absolute pathurl
- page to be relative to
public static String mapPathToRepository(String path)
path
- URI
public static void addParameter(StringBuffer uri, String name, String value)
public static String createAbsoluteLink(NodeData nodedata) throws LinkException
nodedata
- Node data to create link for.
LinkException
AbstractI18nContentSupport
public static String createAbsoluteLink(String repository, 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 String createAbsoluteLink(Content content)
content
- content to create link to.
AbstractI18nContentSupport
public static String createExternalLink(Content content)
content
-
public static String createLink(Content node)
nodedata
- Node data to create link for.
AbstractI18nContentSupport
public static String createLink(NodeData nodedata) throws LinkException
nodedata
- Node data to create link for.
LinkException
AbstractI18nContentSupport
public static String createLink(String repository, 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 |