org.apache.abdera.ext.media.MediaCategory

Here are the examples of the java api class org.apache.abdera.ext.media.MediaCategory taken from open source projects.

1. MediaCategoryTagHandler#doEndTag()

Project: sling
Source File: MediaCategoryTagHandler.java
View license
@Override
public int doEndTag() throws JspException {
    final ServletRequest request = pageContext.getRequest();
    MediaCategory category;
    if (request.getAttribute("content") != null && request.getAttribute("content") instanceof MediaContent) {
        category = ((MediaContent) request.getAttribute("content")).addExtension(MediaConstants.CATEGORY);
    } else if (request.getAttribute("group") != null && request.getAttribute("group") instanceof MediaGroup) {
        category = ((MediaGroup) request.getAttribute("group")).addExtension(MediaConstants.CATEGORY);
    } else if (request.getAttribute("entry") != null && request.getAttribute("entry") instanceof Entry) {
        category = ((Entry) request.getAttribute("entry")).addExtension(MediaConstants.CATEGORY);
    } else {
        category = ((Feed) request.getAttribute("feed")).addExtension(MediaConstants.CATEGORY);
    }
    // set the body content
    category.setText(getBodyContent().getString());
    // set the scheme
    if (scheme != null)
        category.setScheme(scheme);
    if (label != null)
        category.setLabel(label);
    return super.doEndTag();
}