public class SimpleContentRewriter extends AbstractContentRewriter<String>
Modifier and Type | Field and Description |
---|---|
protected static String |
ATTR_END |
protected static Pattern |
BODY_TAG_PATTERN |
protected static String |
END_TAG |
protected static String[] |
EXTERNALS
External URL resources which are not generated from the repository resources.
|
protected static String |
HREF_ATTR_NAME |
protected static Pattern |
HTML_TAG_PATTERN |
protected static String |
IMG_TAG |
protected static String |
LINK_TAG |
protected static String |
SRC_ATTR_NAME |
Constructor and Description |
---|
SimpleContentRewriter() |
Modifier and Type | Method and Description |
---|---|
protected HstLink |
createInternalLink(javax.jcr.Node referencedNode,
HstRequestContext requestContext,
Mount targetMount)
Create an HstLink to a referenced node in rich text.
|
protected String |
decodePath(String path) |
protected HstLink |
getBinaryLink(String path,
javax.jcr.Node node,
HstRequestContext requestContext,
Mount targetMount) |
protected HstLink |
getDocumentLink(String path,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext,
Mount targetMount) |
protected HstLink |
getLink(String path,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext,
Mount targetMount) |
protected boolean |
isExternal(String tagReference)
Check to see if a tag does not reference a dynamic resource
|
String |
rewrite(String html,
HstRequestContext requestContext)
Rewrites the
content with HstRequestContext . |
String |
rewrite(String html,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext)
Rewrites the
content for Node contentNode . |
String |
rewrite(String html,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext,
Mount targetMount)
Rewrite link references in rich text to valid URLs.
|
String |
rewrite(String html,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext,
String targetSiteAlias)
Rewrites the content of the content node.
|
protected String |
rewriteBinaryLink(String binaryLinkReference,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext,
Mount targetMount)
Rewrites binary link in
src attribute of img tag. |
protected String |
rewriteDocumentLink(String documentLinkReference,
javax.jcr.Node hippoHtmlNode,
HstRequestContext requestContext,
Mount targetMount)
Rewrites document link in
href attribute of anchor tag. |
getImageVariant, isCanonicalLinks, isFullyQualifiedLinks, setCanonicalLinks, setFullyQualifiedLinks, setImageVariant
protected static final String[] EXTERNALS
protected static final String LINK_TAG
protected static final String IMG_TAG
protected static final String END_TAG
protected static final String HREF_ATTR_NAME
protected static final String SRC_ATTR_NAME
protected static final String ATTR_END
protected static final Pattern HTML_TAG_PATTERN
protected static final Pattern BODY_TAG_PATTERN
public String rewrite(String html, HstRequestContext requestContext)
ContentRewriter
content
with HstRequestContext
. Since there is no contentNode
param as is for ContentRewriter.rewrite(Object, javax.jcr.Node, org.hippoecm.hst.core.request.HstRequestContext)
this
method typically cannot translate internal links in the content
rewrite
in interface ContentRewriter<String>
rewrite
in class AbstractContentRewriter<String>
public String rewrite(String html, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext)
ContentRewriter
content
for Node
contentNode
.rewrite
in interface ContentRewriter<String>
rewrite
in class AbstractContentRewriter<String>
html
- content object. It can be type of String or whatever, depending on the implementation and the context.hippoHtmlNode
- the Node
that contains the content
requestContext
- the HstRequestContext
T
public String rewrite(String html, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext, String targetSiteAlias)
ContentRewriter
rewrite
in interface ContentRewriter<String>
rewrite
in class AbstractContentRewriter<String>
public String rewrite(String html, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext, Mount targetMount)
rewrite
in interface ContentRewriter<String>
rewrite
in class AbstractContentRewriter<String>
html
- rich text with possible link referenceshippoHtmlNode
- the node that has child nodes that contain references to JCR nodesrequestContext
- the context for the current requesttargetMount
- mount that the links must point toprotected String rewriteDocumentLink(String documentLinkReference, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext, Mount targetMount)
href
attribute of anchor tag.documentLinkReference
- reference to a document link child node of the hippoHtmlNodehippoHtmlNode
- the node that contains rich text and child nodes with jcr linksrequestContext
- the context for the current requesttargetMount
- mount that the link must point toprotected String rewriteBinaryLink(String binaryLinkReference, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext, Mount targetMount)
src
attribute of img
tag.binaryLinkReference
- reference to a document link child node of the hippoHtmlNodehippoHtmlNode
- the node that contains rich text and child nodes with jcr linksrequestContext
- the context for the current requesttargetMount
- mount that the link must point toprotected HstLink getDocumentLink(String path, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext, Mount targetMount)
protected HstLink getBinaryLink(String path, javax.jcr.Node node, HstRequestContext requestContext, Mount targetMount)
protected HstLink getLink(String path, javax.jcr.Node hippoHtmlNode, HstRequestContext requestContext, Mount targetMount)
protected HstLink createInternalLink(javax.jcr.Node referencedNode, HstRequestContext requestContext, Mount targetMount) throws javax.jcr.RepositoryException
referencedNode
- the node to create a link torequestContext
- the context for the current requesttargetMount
- mount that the link must point to. may be nulljavax.jcr.RepositoryException
- if no path can be retrieved from the referencedNodeprotected boolean isExternal(String tagReference)
tagReference
- the tag referenceCopyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.