2 Replies Latest reply on Jun 3, 2008 12:27 PM by oggmeister

    Trouble publishing a RSS feed

    oggmeister

      Hello,


      I'm trying to publish a RSS feed. Therefore I've written the following rss.xml file:


      <?xml version="1.0" encoding="utf-8" ?>
      <rss version="0.91" xmlns:ui="http://java.sun.com/jsf/facelets">
           <channel>
                <title>Hixmen</title>
                <link>http://localhost:8080/hixmen</link>
                <description>Die letzten 10 offiziellen Foreneinträge</description>
                <language>de-de</language>
                
                <ui:repeat value="#{rssFeed.entries}" var="topic">
                <item>
                     <title>#{topic.title}</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=#{topic.id}</link>
                </item>
                </ui:repeat>
      
           </channel>
      </rss>



      When I request that file through my browser (Firefox) by calling http://localhost:8080/hixmen/forum/rss.seam, Firefox allows me to subscribe to the feed. But when I try to access it afterwards, it says that it cannot load the feed (invalid URL). The generated response seams to be sound, though:



      <?xml version="1.0" encoding="utf-8" ?>
      <rss version="0.91">
           <channel>
                <title>Hixmen</title>
                <link>http://localhost:8080/hixmen</link>
                <description>Die letzten 10 offiziellen Foreneintr&auml;ge</description>
                <language>de-de</language>
      
                <item>
                     <title>dfbhvDB</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=79</link>
                </item>
                <item>
                     <title>&ouml;dkjheprowf3ghtd</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=73</link>
      
                </item>
                <item>
                     <title>asdadad</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=67</link>
                </item>
                <item>
                     <title>Titel aus DB</title>
      
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=61</link>
                </item>
                <item>
                     <title>fnhgsc</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=55</link>
                </item>
                <item>
      
                     <title>dfbhvDB</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=49</link>
                </item>
                <item>
                     <title>&ouml;dkjheprowf3ghtd</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=43</link>
                </item>
      
                <item>
                     <title>asdadad</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=37</link>
                </item>
                <item>
                     <title>Titel aus DB</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=31</link>
      
                </item>
                <item>
                     <title>fnhgsc</title>
                     <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=25</link>
                </item>
                
           </channel>
      </rss>




      I guess this has something to do with the feed's URL pointing to rss.seam instead of rss.xml. But when I access http://localhost:8080/hixmen/forum/rss.xml, Seam does not intercept the request and the XML file is return as it is (including the ui:repeat control).


      What can I do?


      Thanks for any help!


       

        • 1. Re: Trouble publishing a RSS feed
          oggmeister

          Update:


          I made Seam intercept the request for rss.xml by adding the following to the web.xml:


          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.xml</url-pattern>
          </servlet-mapping>



          So the feed's URL points to rss.xml now but the problem remains...


          • 2. Re: Trouble publishing a RSS feed
            oggmeister

            Solution:


            I finally solved the problem. It was the HTML-Entities (&auml;, &ouml;). Firefox did not know how to handle them, since there was so schema or dtd defined.


            So I simply replaced the <?xml ... by <!DOCTYPE .... My code now looks looks this:


            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <rss version="0.91" xmlns:ui="http://java.sun.com/jsf/facelets">
                 <channel>
                      <title>Hixmen</title>
                      <link>http://localhost:8080/hixmen</link>
                      <description>Die letzten 10 offiziellen Foreneinträge</description>
                      <language>de-de</language>
                      
                      <ui:repeat value="#{rssFeed.entries}" var="topic">
                           <item>
                                <title>#{topic.title}</title>
                                <link>http://localhost:8080/hixmen/forum/viewTopic.seam?topicId=#{topic.id}</link>
                           </item>
                      </ui:repeat>
            
                 </channel>
            </rss>
            


            Et voilà! Everything works fine.


            Man was that a struggle ...