FileDocCategorySizeDatePackage
RSSChannelTag.javaAPI DocExample1685Sun Nov 23 16:30:32 GMT 2003apexample.view

RSSChannelTag

public class RSSChannelTag extends BodyTagSupport
A custom tag for the RSS channel. Exposes two scripting variables for channel name and link. Also used by nested item tags to find the information for each item in the channel

Fields Summary
private static final String
NAME_ATTR
the names of the scripting variable
private static final String
LINK_ATTR
private String
url
the url of the RSS page
private RSSInfo
rssInfo
the RSS parser
Constructors Summary
Methods Summary
public intdoStartTag()
Register a subscription for the RSS page in question.

        try {
            // create the subscription
            RSSSubscriber rssSubs = RSSSubscriber.getInstance();
            
            // get the most recent parsed data
            rssInfo = rssSubs.getInfo(url);
            
            // export the scripting variables
            pageContext.setAttribute(NAME_ATTR, rssInfo.getChannelTitle());
            pageContext.setAttribute(LINK_ATTR, rssInfo.getChannelLink());
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new JspException("Unable to parse " + url, ex);
        }
        return Tag.EVAL_BODY_INCLUDE;
    
protected RSSInfogetRSSInfo()
Called by nested tags to get the RSS parser

 
        return rssInfo;
    
public voidsetURL(java.lang.String url)
Called with the URL attribute of the tag

       
                 
        
        this.url = url;