public class MediaTag
extends javax.servlet.jsp.tagext.TagSupport
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MEDIA_DATA
Request attribute name to retrieve the Data to be displayed, might be null.
|
static java.lang.String |
MEDIA_DESCRIPTION
Request attribute name to retrieve the description to be displayed, might be null.
|
static java.lang.String |
MEDIA_MAX_HEIGHT
Request attribute name to retrieve the maximum height of the media file to be displayed.
|
static java.lang.String |
MEDIA_MAX_WIDTH
Request attribute name to retrieve the maximum width of the media file to be displayed.
|
static java.lang.String |
MEDIA_PATH
Request attribute name to retrieve the path of the media file to be displayed.
|
static java.lang.String |
REVISION |
Constructor and Description |
---|
MediaTag() |
Modifier and Type | Method and Description |
---|---|
int |
doEndTag() |
int |
doStartTag() |
static java.lang.String |
getMediaTemplatePath(java.lang.String templateName,
Data data)
Deprecated.
use instead
MediaManager.getMediaTemplatePath(String, Data) |
static java.lang.String |
getMediaTemplatePath(java.lang.String templateName,
java.lang.String mediaPath,
java.lang.String mediaContentType)
Deprecated.
|
void |
includeMediaTemplate()
Include the JSP suitable to display the specified media.
|
void |
setData(Data data) |
void |
setDescription(java.lang.String mediaDescription)
Sets a optionnal description to use in appropriate HTML attribute if any (img alt text, title or such).
|
void |
setFile(java.io.File file) |
void |
setFileDoc(FileDocument fileDoc) |
void |
setMaxHeight(int height) |
void |
setMaxWidth(int width) |
void |
setPath(java.lang.String path) |
void |
setTemplate(java.lang.String templateName)
Sets the name of the template to be used by this tag.
|
public static final java.lang.String REVISION
public static final java.lang.String MEDIA_PATH
String path = (String) request.getAttribute(MediaTag.MEDIA_PATH);
public static final java.lang.String MEDIA_MAX_WIDTH
int maxWidth = Util.toInt(request.getAttribute(MediaTag.MEDIA_MAX_WIDTH), 320);
public static final java.lang.String MEDIA_MAX_HEIGHT
int maxHeight = Util.toInt(request.getAttribute(MediaTag.MEDIA_MAX_HEIGHT), 240);
public static final java.lang.String MEDIA_DATA
Data data = (Data) request.getAttribute(MediaTag.MEDIA_DATA);
public static final java.lang.String MEDIA_DESCRIPTION
String mediaDescription = (String) request.getAttribute(MediaTag.MEDIA_DESCRIPTION);
public void setData(Data data)
public void setFileDoc(FileDocument fileDoc)
public void setPath(java.lang.String path)
public void setFile(java.io.File file)
public void setMaxWidth(int width)
public void setMaxHeight(int height)
public void setTemplate(java.lang.String templateName)
See properties media.template.{templateName}.{type-mime}
in jcms.prop
for example on how to define new templates.
templateName
- a template name (default value is "default").public void setDescription(java.lang.String mediaDescription)
If empty, the data's name or the media's path is used.
mediaDescription
- a short description for use in HTML attributespublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
public int doEndTag()
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.TagSupport
public void includeMediaTemplate() throws javax.servlet.ServletException, java.io.IOException
java.io.IOException
- if such an exception occursjavax.servlet.ServletException
- if such an exception occursMediaManager
@Deprecated public static java.lang.String getMediaTemplatePath(java.lang.String templateName, java.lang.String mediaPath, java.lang.String mediaContentType)
MediaManager.getMediaTemplatePath(String, String, String)
templateName
- the name of the template to retrievemediaPath
- the path of the media to display, relative to the webapp root (eg. upload/docs/myfile.ext) can also be an URL such as
https://www.youtube.com/watch?v=abc (if supported in template declarations)mediaContentType
- the content type of the media to display (eg. image/jpeg)@Deprecated public static java.lang.String getMediaTemplatePath(java.lang.String templateName, Data data)
MediaManager.getMediaTemplatePath(String, Data)
templateName
- the name of the template to retrievedata
- the Data to displayCopyright © 2001-2018 Jalios SA. All Rights Reserved.