@Override
public int doEndTag() throws JspException {
final ServletRequest request = pageContext.getRequest();
MediaPlayer player;
if (request.getAttribute("content") != null
&& request.getAttribute("content") instanceof MediaContent) {
player = ((MediaContent) request.getAttribute("content")).addExtension(MediaConstants.PLAYER);
} else if (request.getAttribute("group") != null
&& request.getAttribute("group") instanceof MediaGroup) {
player = ((MediaGroup) request.getAttribute("group")).addExtension(MediaConstants.PLAYER);
} else if (request.getAttribute("entry") != null
&& request.getAttribute("entry") instanceof Entry) {
player = ((Entry) request.getAttribute("entry")).addExtension(MediaConstants.PLAYER);
} else {
player = ((Feed) request.getAttribute("feed")).addExtension(MediaConstants.PLAYER);
}
// set the scheme
player.setUrl(url);
if (width != 0) player.setWidth(width);
if (height != 0) player.setHeight(height);
return super.doEndTag();
}