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