Source Code Cross Referenced for JSPRenderingProvider.java in  » Portal » Open-Portal » com » sun » portal » wireless » providers » rendering » 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 » Portal » Open Portal » com.sun.portal.wireless.providers.rendering 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: JSPRenderingProvider.java,v 1.10 2005/09/21 10:49:12 dg154973 Exp $
003:         * Copyright 2003 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and iPlanet
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wireless.providers.rendering;
014:
015:        import com.sun.portal.providers.jsp.JSPProvider;
016:        import com.sun.portal.providers.context.ProviderContext;
017:        import com.sun.portal.providers.context.ContainerProviderContext;
018:        import com.sun.portal.providers.ProviderException;
019:        import com.sun.portal.providers.context.ProviderContextException;
020:        import com.sun.portal.log.common.PortalLogger;
021:
022:        import javax.servlet.http.HttpServletRequest;
023:        import javax.servlet.http.HttpServletResponse;
024:        import java.io.File;
025:        import java.util.logging.Level;
026:        import java.util.logging.Logger;
027:
028:        /**   
029:         * The <code>JSPRenderingProvider</code> class extends from the 
030:         * <code>JSPProvider</code> and overrides the <code>getContent, 
031:         * getEdit</code> and <code>getMostSpecificPath</code> 
032:         * methods of <code>JSPProvider</code>. This is a public class and
033:         * can be extended to add more functionality to the provider if needed.
034:         * It gets the AML content from JSP templates for the provider and based on a 
035:         * few checks, it decides whether to pass the AML content back to the
036:         * container or call the RenderingEngine
037:         * itself and pass back device specific markup to the container.
038:         * <p>Rendering Channels created using this 
039:         * JSPRenderingProvider can be a part of either RenderingContainers or 
040:         * NativeContainers. While creating channels using 
041:         * <code>JSPRenderingProvider</code>, the channel developer 
042:         * has to write a contentPage.jsp and editPage.jsp (if channel is editable) 
043:         * which would get the content from AML JSPs it has.<p>
044:         * All JSPs created for the channel should be valid AML documents.
045:         */
046:
047:        public class JSPRenderingProvider extends JSPProvider {
048:
049:            private static Logger logger = PortalLogger
050:                    .getLogger(JSPRenderingProvider.class);
051:
052:            public void init(String name, HttpServletRequest req)
053:                    throws ProviderException {
054:                super .init(name, req);
055:            }
056:
057:            /**
058:             * This method overrides <code>JSPProvider.getContent()</code> method. It
059:             * gets the JSP content from <code>JSPProvider</code> and pass it to
060:             * <code>renderContent()</code> method. 
061:             * Based on a few check, it will either return device specfic markup or AML.
062:             *
063:             * @return  StringBuffer holding the channel content that is markup specific 
064:             *          or AML.
065:             * @exception ProviderException If there was an error generating the content.
066:             *
067:             * @param request  An HttpServletRequest that contains information related to
068:             *                 this request for content.
069:             * @param response An HttpServletResponse that allows the provider to 
070:             *                 influence overall response for the desktop page.
071:             * @see com.sun.portal.providers.jsp.JSPProvider#getContent
072:             **/
073:
074:            public StringBuffer getContent(HttpServletRequest req,
075:                    HttpServletResponse res) throws ProviderException {
076:                StringBuffer sb = super .getContent(req, res);
077:                return renderContent(req, sb);
078:            }
079:
080:            /**
081:             * This method overrides <code>JSPProvider.getEdit()</code> method. It gets
082:             * the JSP edit page content from <code>JSPProvider</code> and pass it to
083:             * <code>renderContent()</code> method. 
084:             * Based on a few check, it will either return device specfic markup or AML.
085:             *
086:             * @return StringBuffer holding the channel edit page that is markup  
087:             *         specific or AML.
088:             * @exception ProviderException If there was an error generating the content.
089:             *
090:             * @param request   An HttpServletRequest that contains information related x
091:             *                  to this request for content.
092:             * @param response  An HttpServletResponse that allows the provider to 
093:             *                  influence overall response for the desktop page.
094:             * @see com.sun.portal.providers.jsp.JSPProvider#getEdit
095:             *
096:             **/
097:            public StringBuffer getEdit(HttpServletRequest req,
098:                    HttpServletResponse res) throws ProviderException {
099:                StringBuffer sb = super .getEdit(req, res);
100:                return renderEditContent(req, sb);
101:            }
102:
103:            /**
104:             * This method is expected to be called from the Provider's 
105:             * <code>getContent()</code> methods after it creates its content 
106:             * StringBuffer. It calls <code>RenderingUtil.renderContent()</code>
107:             * to render the content. The return buffer can contain device specific 
108:             * markup (rendered) or remain as AML document (not rendered).
109:             * 
110:             * @param req An HttpServletRequest that contains information related to this
111:             *            request for content.
112:             * @param sb  The StringBuffer representing the content obtained 
113:             *            from the JSPs.
114:             *
115:             * @return StringBuffer  The return content can be rendered or not rendered.
116:             * @see com.sun.portal.wireless.providers.rendering.
117:             *  RenderingUtil#renderContent
118:             */
119:
120:            protected StringBuffer renderContent(HttpServletRequest req,
121:                    StringBuffer sb) throws ProviderException {
122:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
123:                return RenderingUtil.renderContent(req, cpc, getName(), sb);
124:            }
125:
126:            /**
127:             * This method is expected to be called from the Provider's <code>getEdit()
128:             * </code> methods after it creates its content StringBuffer. It calls
129:             * <code>RenderingUtil.renderEditContent()</code> to render the content. 
130:             * The return buffer can contain device specific markup (rendered) or 
131:             * remain as AML document (not rendered).
132:             * 
133:             * @param req An HttpServletRequest that contains information related to this
134:             *            request for content.
135:             * @param sb  The StringBuffer representing the content obtained 
136:             *            from the JSPs.
137:             *
138:             * @return StringBuffer  The return content can be rendered or not rendered.
139:             * @see com.sun.portal.wireless.providers.rendering.
140:             *  RenderingUtil#renderContent
141:             */
142:
143:            protected StringBuffer renderEditContent(HttpServletRequest req,
144:                    StringBuffer sb) throws ProviderException {
145:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
146:                return RenderingUtil.renderEditContent(req, cpc, getName(), sb);
147:            }
148:
149:            /**
150:             * Get the most specific JSP path for the given channel name and
151:             * file name.  This method overrides the <code>JSPProvider.
152:             * getMostSpecificJSPPath()</code>
153:             * method and calls <code>RenderingUtils.getTemplateMostSpecificPath</code> 
154:             * to get the real path.
155:             *
156:             * @param pc   The ProviderContext.
157:             * @param name The channel name.
158:             * @param file The jsp file name.
159:             *
160:             * @return 
161:             *
162:             * @exception  ProviderException if an error occurs in getting the path.
163:             * @see com.sun.portal.providers.jsp.JSPProvider#getMostSpecificJSPPath
164:             * @see com.sun.portal.wireless.providers.rendering.
165:             *   RenderingUtil#getTemplateMostSpecificPath
166:             **/
167:
168:            protected File getMostSpecificJSPPath(ProviderContext pc,
169:                    String name, String file) throws ProviderException {
170:                File jspPath = null;
171:                try {
172:                    jspPath = RenderingUtil.getTemplateMostSpecificPath(
173:                            (ContainerProviderContext) pc, name, file);
174:                } catch (ProviderContextException e) {
175:                    if (logger.isLoggable(Level.SEVERE))
176:                        logger.log(Level.SEVERE, "PSMA_CSPWPR0008", e);
177:
178:                    throw new ProviderException(e.getMessage());
179:                }
180:
181:                return jspPath;
182:            }
183:
184:            /**
185:             * Get the most specific JSP path for the given channel name and
186:             * file name.  This method overrides the <code>JSPProvider.
187:             * getExistingJSPPath()</code>
188:             * method and calls <code>RenderingUtils.getTemplatePath</code> to get 
189:             * the real path.
190:             *
191:             * @param pc   The ProviderContext.
192:             * @param name The channel name.
193:             * @param file The jsp file name.
194:             *
195:             * @return 
196:             *
197:             * @exception  ProviderException if an error occurs in getting the path.
198:             * @see com.sun.portal.providers.jsp.JSPProvider#getExistingJSPPath
199:             * @see com.sun.portal.wireless.providers.rendering.
200:             *  RenderingUtil#getTemplatePath
201:             **/
202:            public File getExistingJSPPath(ProviderContext pc, String name,
203:                    String file) throws ProviderException {
204:                File jspPath = null;
205:                try {
206:                    jspPath = RenderingUtil.getTemplatePath(
207:                            (ContainerProviderContext) pc, name, file);
208:                } catch (ProviderContextException e) {
209:                    if (logger.isLoggable(Level.SEVERE))
210:                        logger.log(Level.SEVERE, "PSMA_CSPWPR0008", e);
211:                    throw new ProviderException(e.getMessage());
212:                }
213:
214:                return jspPath;
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.