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)
Retrieve the path of the JSP suitable to display the specified Data.
|
static java.lang.String |
getMediaTemplatePath(java.lang.String templateName,
java.lang.String mediaPath,
java.lang.String mediaContentType)
Retrieve the path of the JSP suitable to display the specified media.
|
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
javax.servlet.ServletException
public static java.lang.String getMediaTemplatePath(java.lang.String templateName, java.lang.String mediaPath, java.lang.String mediaContentType)
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)mediaContentType
- the content type of the media to display (eg. image/jpeg)public static java.lang.String getMediaTemplatePath(java.lang.String templateName, Data data)
templateName
- the name of the template to retrievedata
- the Data to displayCopyright © 2001-2010 Jalios SA. All Rights Reserved.