public class CmsJspTagLink extends javax.servlet.jsp.tagext.BodyTagSupport
<cms:link>[filename]</cms:link>
tag to add OpenCms managed links to a JSP page, required for link
management and the static
export to work properly.| Constructor and Description |
|---|
CmsJspTagLink() |
| Modifier and Type | Method and Description |
|---|---|
int |
doEndTag() |
java.lang.String |
getBaseUri()
Returns the base URI used to create the link target.
|
java.lang.String |
getDetailPage()
Returns the target detail page path.
|
static java.lang.String |
linkTagAction(java.lang.String target,
javax.servlet.ServletRequest req)
Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.
|
static java.lang.String |
linkTagAction(java.lang.String target,
javax.servlet.ServletRequest req,
java.lang.String baseUri)
Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.
|
static java.lang.String |
linkTagAction(java.lang.String target,
javax.servlet.ServletRequest req,
java.lang.String baseUri,
java.util.Locale locale)
Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.
|
static java.lang.String |
linkTagAction(java.lang.String target,
javax.servlet.ServletRequest req,
java.lang.String baseUri,
java.lang.String detailPage,
java.util.Locale locale)
Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.
|
void |
release() |
void |
setBaseUri(java.lang.String baseUri)
Sets the base URI used to create the link target.
|
void |
setDetailPage(java.lang.String detailPage)
Sets the target detail page path.
|
void |
setLocale(java.lang.String localeName)
Sets the locale for the link to create.
|
doAfterBody, doInitBody, doStartTag, getBodyContent, getPreviousOut, setBodyContentfindAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValuepublic CmsJspTagLink()
public static java.lang.String linkTagAction(java.lang.String target, javax.servlet.ServletRequest req)
The current OpenCms user context URI will be used as source of the link.
Since OpenCms version 7.0.2, you can also use this method in case you are not sure if the link is internal or external, asCmsLinkManager.substituteLinkForUnknownTarget(org.opencms.file.CmsObject, String)
is used to calculate the link target.Relative links are converted to absolute links, using the current element URI as base.
target - the link that should be calculated, can be relative or absolutereq - the current requestCmsLinkManager.substituteLinkForUnknownTarget(org.opencms.file.CmsObject, String)public static java.lang.String linkTagAction(java.lang.String target, javax.servlet.ServletRequest req, java.lang.String baseUri)
If the baseUri parameter is provided, this will be treated as the source of the link,
if this is null then the current OpenCms user context URI will be used as source.
target - the link that should be calculated, can be relative or absolutereq - the current requestbaseUri - the base URI for the link sourcelinkTagAction(String, ServletRequest)public static java.lang.String linkTagAction(java.lang.String target, javax.servlet.ServletRequest req, java.lang.String baseUri, java.util.Locale locale)
If the baseUri parameter is provided, this will be treated as the source of the link,
if this is null then the current OpenCms user context URI will be used as source.
If the locale parameter is provided, the locale in the request context will be switched
to the provided locale. This influences only the behavior of the
CmsLocalePrefixLinkSubstitutionHandler.
target - the link that should be calculated, can be relative or absolutereq - the current requestbaseUri - the base URI for the link sourcelocale - the locale for which the link should be created (see CmsLocalePrefixLinkSubstitutionHandlerlinkTagAction(String, ServletRequest)public static java.lang.String linkTagAction(java.lang.String target, javax.servlet.ServletRequest req, java.lang.String baseUri, java.lang.String detailPage, java.util.Locale locale)
If the baseUri parameter is provided, this will be treated as the source of the link,
if this is null then the current OpenCms user context URI will be used as source.
If the locale parameter is provided, the locale in the request context will be switched
to the provided locale. This influences only the behavior of the
CmsLocalePrefixLinkSubstitutionHandler.
target - the link that should be calculated, can be relative or absolutereq - the current requestbaseUri - the base URI for the link sourcedetailPage - the target detail page, in case of linking to a specific detail pagelocale - the locale for which the link should be created (see CmsLocalePrefixLinkSubstitutionHandlerlinkTagAction(String, ServletRequest)public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag in interface javax.servlet.jsp.tagext.TagdoEndTag in class javax.servlet.jsp.tagext.BodyTagSupportjavax.servlet.jsp.JspException - in case something goes wrongTag.doEndTag()public java.lang.String getBaseUri()
public java.lang.String getDetailPage()
public void release()
release in interface javax.servlet.jsp.tagext.Tagrelease in class javax.servlet.jsp.tagext.BodyTagSupportTag.release()public void setBaseUri(java.lang.String baseUri)
baseUri - the base URI used to create the link targetpublic void setDetailPage(java.lang.String detailPage)
detailPage - the target detail page pathpublic void setLocale(java.lang.String localeName)
localeName - name of the locale, e.g. "en", "en_US", ...