com.day.cq.commons.feed
Class AbstractFeed

java.lang.Object
  extended by com.day.cq.commons.feed.AbstractFeed
All Implemented Interfaces:
Feed
Direct Known Subclasses:
AtomFeed, RssFeed

public abstract class AbstractFeed
extends Object
implements Feed

The AbstractFeed serves as a base for classes printing resources as feeds.


Field Summary
 
Fields inherited from interface com.day.cq.commons.feed.Feed
DEFAULT_CHARACTER_ENCODING, DEFAULT_CONTENT_TYPE, SELECTOR_ATOM, SELECTOR_FEED, SELECTOR_FEEDENTRY, SELECTOR_RSS, SUFFIX_COMMENTS, SUFFIX_FEED, SUFFIX_FEEDENTRY, SUFFIX_HTML, SUFFIX_XML
 
Constructor Summary
AbstractFeed(Resource res, SlingHttpServletRequest req, SlingHttpServletResponse resp)
          Creates a new feed instance using the specified resource.
 
Method Summary
 String getCharacterEncoding()
          Returns the character encoding of the feed.
 String getContentType()
          Returns the content type of the feed.
 void printChildEntries()
          Prints the children of the current resource as feed entries
 void printChildEntries(int max)
          Prints the children of the current resource as feed entries
 void printEntries(Iterator<Resource> iter)
          Prints the specified resources as feed entries
 void printEntries(Iterator<Resource> iter, int max)
          Prints the specified resources as feed entries
 void printEntry(Resource res)
          Prints the specified resource as a feed entry
 void printFooter()
          Writes the feed footer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.day.cq.commons.feed.Feed
printEntry, printHeader
 

Constructor Detail

AbstractFeed

public AbstractFeed(Resource res,
                    SlingHttpServletRequest req,
                    SlingHttpServletResponse resp)
             throws RepositoryException
Creates a new feed instance using the specified resource.

Parameters:
res - The resource
req - The servlet request
resp - The servlet response
Throws:
RepositoryException - if no node can be found
Method Detail

getContentType

public String getContentType()
Returns the content type of the feed.

Specified by:
getContentType in interface Feed
Returns:
The type

getCharacterEncoding

public String getCharacterEncoding()
Returns the character encoding of the feed.

Specified by:
getCharacterEncoding in interface Feed
Returns:
The encoding

printEntry

public void printEntry(Resource res)
                throws IOException
Prints the specified resource as a feed entry

Specified by:
printEntry in interface Feed
Parameters:
res - the resource
Throws:
IOException - If output fails

printChildEntries

public void printChildEntries()
                       throws IOException
Prints the children of the current resource as feed entries

Specified by:
printChildEntries in interface Feed
Throws:
IOException - If output fails

printChildEntries

public void printChildEntries(int max)
                       throws IOException
Prints the children of the current resource as feed entries

Specified by:
printChildEntries in interface Feed
Parameters:
max - The maximum number of entries
Throws:
IOException - If output fails

printEntries

public void printEntries(Iterator<Resource> iter)
                  throws IOException
Prints the specified resources as feed entries

Specified by:
printEntries in interface Feed
Parameters:
iter - The resources
Throws:
IOException - If output fails

printEntries

public void printEntries(Iterator<Resource> iter,
                         int max)
                  throws IOException
Prints the specified resources as feed entries

Specified by:
printEntries in interface Feed
Parameters:
iter - The resources
max - The maximum number of entries
Throws:
IOException - If output fails

printFooter

public void printFooter()
                 throws IOException
Writes the feed footer.

Specified by:
printFooter in interface Feed
Throws:
IOException - If output fails


Copyright © 2011-2013 Adobe Systems Incorporated. All Rights Reserved.