Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.apache.activemq.web.view;
 import java.util.Date;
 import java.util.List;
This renderer uses XStream to render messages on a queue as full XML elements

$Revision: $
 public class RssMessageRenderer extends SimpleMessageRenderer {
     // private String feedType = "atom_0.3";
     private String feedType = "rss_2.0";
     private SyndFeed feed;
     private String description = "This feed is auto-generated by Apache ActiveMQ";
     private String entryContentType = "text/plain";
     public void renderMessage(PrintWriter writerHttpServletRequest requestHttpServletResponse responseQueueBrowser browserMessage messagethrows JMSException {
         SyndFeed feed = getFeed(browserrequest);
         List<SyndEntryentries = feed.getEntries();
         SyndEntry entry = createEntry(browsermessagerequest);
         SyndContent description = createEntryContent(browsermessagerequest);
     // Properties
     // -------------------------------------------------------------------------
     public String getDescription() {
         return ;
     public void setDescription(String feedDescription) {
         this. = feedDescription;
     public String getFeedType() {
         return ;
     public void setFeedType(String feedType) {
         this. = feedType;
     public String getEntryContentType() {
         return ;
     public void setEntryContentType(String entryContentType) {
         this. = entryContentType;
     // Implementation methods
     // -------------------------------------------------------------------------
     protected void printFooter(PrintWriter writerQueueBrowser browserHttpServletRequest requestthrows IOExceptionJMSExceptionServletException {
         // now lets actually write out the content
         SyndFeed feed = getFeed(browserrequest);
         SyndFeedOutput output = new SyndFeedOutput();
         try {
         } catch (FeedException e) {
            throw new ServletException(e);
    protected void printHeader(PrintWriter writerQueueBrowser browserHttpServletRequest requestthrows IOExceptionJMSException {
    public SyndFeed getFeed(QueueBrowser browserHttpServletRequest requestthrows JMSException {
        if ( == null) {
             = createFeed(browserrequest);
        return ;
    protected SyndEntry createEntry(QueueBrowser browserMessage messageHttpServletRequest requestthrows JMSException {
        SyndEntry entry = new SyndEntryImpl();
        String title = message.getJMSMessageID();
        String link = request.getRequestURI() + "?msgId=" + title;
        entry.setPublishedDate(new Date());
        return entry;
    protected SyndContent createEntryContent(QueueBrowser browserMessage messageHttpServletRequest requestthrows JMSException {
        SyndContent description = new SyndContentImpl();
        if (message instanceof TextMessage) {
            String text = ((TextMessage)message).getText();
        return description;
    protected SyndFeed createFeed(QueueBrowser browserHttpServletRequest requestthrows JMSException {
        SyndFeed feed = new SyndFeedImpl();
        String title = browser.getQueue().toString();
        String selector = browser.getMessageSelector();
        if (selector != null) {
            title += " with selector: " + selector;
        return feed;
New to GrepCode? Check out our FAQ X