Source Code Cross Referenced for AbstractRSSView.java in  » Project-Management » EmForce » ru » emdev » EmForge » rss » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Project Management » EmForce » ru.emdev.EmForge.rss 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package ru.emdev.EmForge.rss;
002:
003:        import java.util.Map;
004:
005:        import javax.servlet.http.HttpServletRequest;
006:        import javax.servlet.http.HttpServletResponse;
007:
008:        import org.springframework.web.servlet.view.AbstractView;
009:
010:        import ru.emdev.EmForge.EmForgeContext;
011:
012:        import com.sun.syndication.feed.synd.SyndFeed;
013:        import com.sun.syndication.feed.synd.SyndFeedImpl;
014:        import com.sun.syndication.feed.synd.SyndImage;
015:        import com.sun.syndication.feed.synd.SyndImageImpl;
016:        import com.sun.syndication.io.SyndFeedOutput;
017:
018:        /** Abstract RSS View
019:         * 
020:         * This class is used as base class for all RSS View in EmForge Project
021:         * @note Initially I wrote this code based on zabada's recipes project example
022:         * @note But I decided to use Rome instead of RSSLibJ since it is more up-to-dated project 
023:         */
024:        public abstract class AbstractRSSView extends AbstractView {
025:            /// feed description
026:            protected String m_description;
027:            /// feed link
028:            protected String m_link;
029:            /// feed title
030:            protected String m_title;
031:            /// feed's image path
032:            protected String m_imagePath;
033:
034:            protected EmForgeContext m_appContext;
035:
036:            public void setDescription(String description) {
037:                m_description = description;
038:            }
039:
040:            public void setLink(String link) {
041:                m_link = link;
042:            }
043:
044:            public void setTitle(String title) {
045:                m_title = title;
046:            }
047:
048:            public void setImagePath(String imagePath) {
049:                m_imagePath = imagePath;
050:            }
051:
052:            public void setAppContext(EmForgeContext i_appContext) {
053:                m_appContext = i_appContext;
054:            }
055:
056:            public AbstractRSSView() {
057:                setContentType("text/xml; charset=UTF-8");
058:            }
059:
060:            /**
061:             * Renders the view given the specified model.
062:             */
063:            protected final void renderMergedOutputModel(Map i_model,
064:                    HttpServletRequest i_request, HttpServletResponse o_response)
065:                    throws Exception {
066:                SyndFeed feed = new SyndFeedImpl();
067:
068:                buildRSSFeed(i_model, feed, i_request, o_response);
069:
070:                feed.setFeedType("rss_2.0");
071:
072:                feed.setDescription(m_description);
073:                feed.setLink(m_link);
074:                feed.setTitle(m_title);
075:
076:                SyndImage image = new SyndImageImpl();
077:                image.setLink(m_link);
078:                image.setTitle(m_title);
079:                image.setUrl(m_imagePath);
080:                image.setDescription(m_description);
081:                feed.setImage(image);
082:
083:                o_response.setContentType(getContentType());
084:                o_response.setCharacterEncoding("UTF-8");
085:
086:                SyndFeedOutput syndOut = new SyndFeedOutput();
087:                syndOut.output(feed, o_response.getWriter());
088:            }
089:
090:            /**
091:             * Subclasses must implement this method to create an RSS Feed
092:             * given the model.
093:             * @param model the model Map
094:             * @param feed the RSS Feed
095:             * @param request in case we need locale etc. Shouldn't look at attributes.
096:             * @param response in case we need to set cookies. Shouldn't write to it.
097:             */
098:            protected abstract void buildRSSFeed(Map i_model, SyndFeed i_feed,
099:                    HttpServletRequest i_request, HttpServletResponse o_response)
100:                    throws Exception;
101:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.