servletContext = m_wikiContext.getHttpRequest().getSession().getServletContext();
for( Iterator i = m_entries.iterator(); i.hasNext(); )
{
Entry e = (Entry)i.next();
WikiPage p = e.getPage();
String url = e.getURL();
Element item = new Element("item");
item.addContent( new Element("link").setText(url) );
item.addContent( new Element("title").setText( e.getTitle()) );
item.addContent( new Element("description").setText( e.getContent()) );
//
// Attachments for enclosures
//
if( engine.getAttachmentManager().hasAttachments(p) && servletContext != null )
{
try
{
Collection c = engine.getAttachmentManager().listAttachments(p);
for( Iterator a = c.iterator(); a.hasNext(); )
{
Attachment att = (Attachment) a.next();
Element attEl = new Element("enclosure");
attEl.setAttribute( "url", engine.getURL(WikiContext.ATTACH, att.getName(), null, true ) );
attEl.setAttribute( "length", Long.toString(att.getSize()) );
attEl.setAttribute( "type", getMimeType( servletContext, att.getFileName() ) );
item.addContent( attEl );
}
}
catch( ProviderException ex )
{
// FIXME: log.info("Can't get attachment data",ex);
}
}
//
// Modification date.
//
Calendar cal = Calendar.getInstance();
cal.setTime( p.getLastModified() );
cal.add( Calendar.MILLISECOND,
- (cal.get( Calendar.ZONE_OFFSET ) +
(cal.getTimeZone().inDaylightTime( p.getLastModified() ) ? cal.get( Calendar.DST_OFFSET ) : 0 )) );
item.addContent( new Element("pubDate").setText(fmt.format(cal.getTime())) );
list.add( item );
}