This renderer uses XStream to render messages on a queue as full XML elements
Method from org.apache.activemq.web.view.RssMessageRenderer Detail: |
protected SyndEntry createEntry(QueueBrowser browser,
Message message,
HttpServletRequest request) throws JMSException {
SyndEntry entry = new SyndEntryImpl();
String title = message.getJMSMessageID();
entry.setTitle(title);
String link = request.getRequestURI() + "?msgId=" + title;
entry.setLink(link);
entry.setPublishedDate(new Date());
return entry;
}
|
protected SyndContent createEntryContent(QueueBrowser browser,
Message message,
HttpServletRequest request) throws JMSException {
SyndContent description = new SyndContentImpl();
description.setType(entryContentType);
if (message instanceof TextMessage) {
String text = ((TextMessage)message).getText();
description.setValue(text);
}
return description;
}
|
protected SyndFeed createFeed(QueueBrowser browser,
HttpServletRequest request) throws JMSException {
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType(feedType);
String title = browser.getQueue().toString();
String selector = browser.getMessageSelector();
if (selector != null) {
title += " with selector: " + selector;
}
feed.setTitle(title);
feed.setLink(request.getRequestURI());
feed.setDescription(getDescription());
return feed;
}
|
public String getDescription() {
return description;
}
|
public String getEntryContentType() {
return entryContentType;
}
|
public SyndFeed getFeed(QueueBrowser browser,
HttpServletRequest request) throws JMSException {
if (feed == null) {
feed = createFeed(browser, request);
}
return feed;
}
|
public String getFeedType() {
return feedType;
}
|
protected void printFooter(PrintWriter writer,
QueueBrowser browser,
HttpServletRequest request) throws IOException, JMSException, ServletException {
// now lets actually write out the content
SyndFeed feed = getFeed(browser, request);
SyndFeedOutput output = new SyndFeedOutput();
try {
output.output(feed, writer);
} catch (FeedException e) {
throw new ServletException(e);
}
}
|
protected void printHeader(PrintWriter writer,
QueueBrowser browser,
HttpServletRequest request) throws IOException, JMSException {
}
|
public void renderMessage(PrintWriter writer,
HttpServletRequest request,
HttpServletResponse response,
QueueBrowser browser,
Message message) throws JMSException {
SyndFeed feed = getFeed(browser, request);
List< SyndEntry > entries = feed.getEntries();
SyndEntry entry = createEntry(browser, message, request);
SyndContent description = createEntryContent(browser, message, request);
entry.setDescription(description);
entries.add(entry);
}
|
public void setDescription(String feedDescription) {
this.description = feedDescription;
}
|
public void setEntryContentType(String entryContentType) {
this.entryContentType = entryContentType;
}
|
public void setFeedType(String feedType) {
this.feedType = feedType;
}
|