@Override
public int doStartTag() {
final ServletRequest request = pageContext.getRequest();
MediaContent content;
if (request.getAttribute("group") instanceof MediaGroup) {
MediaGroup group = (MediaGroup) request.getAttribute("group");
content = group.addExtension(MediaConstants.CONTENT);
} else {
Entry entry = getEntry();
content = entry.addExtension(MediaConstants.CONTENT);
}
if (url != null) {
content.setUrl(url.replaceAll(" ", "%20"));
}
if (fileSize != 0) {
content.setFilesize(fileSize);
}
if (type != null) {
content.setType(type);
}
if (medium != null) content.setMedium(Medium.valueOf(medium));
if (expression != null)
content.setExpression(Expression.valueOf(expression));
if (bitrate != 0) content.setBitrate(bitrate);
if (samplingrate != 0) content.setSamplingRate(samplingrate);
if (framerate != 0) content.setFramerate(framerate);
if (channels != 0) content.setChannels(channels);
if (duration != 0) content.setDuration(duration);
if (height != 0) content.setHeight(height);
if (width != 0) content.setWidth(width);
request.setAttribute("content", content);
return EVAL_BODY_INCLUDE;
}