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