@Override
public int doEndTag() throws JspException {
final ServletRequest request = pageContext.getRequest();
MediaDescription description;
if (request.getAttribute("content") != null
&& request.getAttribute("content") instanceof MediaContent) {
description = ((MediaContent) request.getAttribute("content")).addExtension(MediaConstants.DESCRIPTION);
} else if (request.getAttribute("group") != null
&& request.getAttribute("group") instanceof MediaGroup) {
description = ((MediaGroup) request.getAttribute("group")).addExtension(MediaConstants.DESCRIPTION);
} else if (request.getAttribute("entry") != null
&& request.getAttribute("entry") instanceof Entry) {
description = ((Entry) request.getAttribute("entry")).addExtension(MediaConstants.DESCRIPTION);
} else {
description = ((Feed) request.getAttribute("feed")).addExtension(MediaConstants.DESCRIPTION);
}
// set the body content
description.setText(getBodyContent().getString());
// set the scheme
if (type != null) description.setType(Type.valueOf(type));
return super.doEndTag();
}