Source Code Cross Referenced for HTMLFormatProvider.java in  » Profiler » MessAdmin » clime » messadmin » providers » displayformat » 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 » Profiler » MessAdmin » clime.messadmin.providers.displayformat 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         */package clime.messadmin.providers.displayformat;
004:
005:        import java.io.IOException;
006:        import java.util.Collection;
007:        import java.util.Set;
008:
009:        import javax.servlet.ServletConfig;
010:        import javax.servlet.ServletContext;
011:        import javax.servlet.ServletException;
012:        import javax.servlet.http.HttpServletRequest;
013:        import javax.servlet.http.HttpServletResponse;
014:
015:        import clime.messadmin.model.IApplicationInfo;
016:        import clime.messadmin.model.IServerInfo;
017:        import clime.messadmin.model.ISessionInfo;
018:        import clime.messadmin.providers.spi.DisplayFormatProvider;
019:
020:        /**
021:         * IMPLEMENTATION NOTE: always use include() instead of forward(), to get the real name of this servlet in jsp's
022:         * @author Cédrik LIME
023:         * @since 4.1
024:         */
025:        public class HTMLFormatProvider implements  DisplayFormatProvider {
026:            private transient ServletConfig config;
027:
028:            protected String webFilesRoot = "/MessAdmin/";//$NON-NLS-1$
029:            protected String serverInfosJspPath = webFilesRoot
030:                    + "serverInfos.jsp";//$NON-NLS-1$
031:            protected String webAppsListJspPath = webFilesRoot
032:                    + "webAppsList.jsp";//$NON-NLS-1$
033:            protected String webAppStatsJspPath = webFilesRoot
034:                    + "webAppStats.jsp";//$NON-NLS-1$
035:            protected String sessionsListJspPath = webFilesRoot
036:                    + "sessionsList.jsp";//$NON-NLS-1$
037:            protected String sessionDetailJspPath = webFilesRoot
038:                    + "sessionDetail.jsp";//$NON-NLS-1$
039:
040:            /**
041:             * 
042:             */
043:            public HTMLFormatProvider() {
044:                super ();
045:            }
046:
047:            /* (non-Javadoc)
048:             * @see clime.messadmin.providers.spi.BaseProvider#getPriority()
049:             */
050:            public int getPriority() {
051:                return 0;
052:            }
053:
054:            /* (non-Javadoc)
055:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#getFormatID()
056:             */
057:            public String getFormatID() {
058:                return "html";//$NON-NLS-1$
059:            }
060:
061:            /* (non-Javadoc)
062:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#getContentType()
063:             */
064:            public String getContentType() {
065:                return "text/html;charset=UTF-8";//should be "application/xhtml+xml", but IE screws us once again... //$NON-NLS-1$
066:            }
067:
068:            /* (non-Javadoc)
069:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#init(javax.servlet.ServletConfig)
070:             */
071:            public void init(ServletConfig config) throws ServletException {
072:                this .config = config;
073:                String initWebFilesRoot = getServletConfig().getInitParameter(
074:                        "WebFilesRoot");//$NON-NLS-1$
075:                if (null != initWebFilesRoot) {
076:                    webFilesRoot = initWebFilesRoot;
077:                }
078:                if (!webFilesRoot.startsWith("/")) {//$NON-NLS-1$
079:                    webFilesRoot = '/' + webFilesRoot;
080:                }
081:                if (!webFilesRoot.endsWith("/")) {//$NON-NLS-1$
082:                    webFilesRoot += '/';
083:                }
084:                String initServerInfosJspPath = getServletConfig()
085:                        .getInitParameter("ServerInfosJsp");//$NON-NLS-1$
086:                if (null != initServerInfosJspPath) {
087:                    serverInfosJspPath = webFilesRoot + initServerInfosJspPath;
088:                }
089:                String initWebAppsListJspPath = getServletConfig()
090:                        .getInitParameter("WebAppsListJsp");//$NON-NLS-1$
091:                if (null != initWebAppsListJspPath) {
092:                    webAppsListJspPath = webFilesRoot + initWebAppsListJspPath;
093:                }
094:                String initWebAppStatsJspPathJspPath = getServletConfig()
095:                        .getInitParameter("WebAppStatsJsp");//$NON-NLS-1$
096:                if (null != initWebAppStatsJspPathJspPath) {
097:                    webAppStatsJspPath = webFilesRoot
098:                            + initWebAppStatsJspPathJspPath;
099:                }
100:                String initSessionsListJspPath = getServletConfig()
101:                        .getInitParameter("SessionsListJsp");//$NON-NLS-1$
102:                if (null != initSessionsListJspPath) {
103:                    sessionsListJspPath = webFilesRoot
104:                            + initSessionsListJspPath;
105:                }
106:                String initSessionDetailJspPath = getServletConfig()
107:                        .getInitParameter("SessionDetailJsp");//$NON-NLS-1$
108:                if (null != initSessionDetailJspPath) {
109:                    sessionDetailJspPath = webFilesRoot
110:                            + initSessionDetailJspPath;
111:                }
112:            }
113:
114:            /**
115:             * Returns this servlet's {@link ServletConfig} object.
116:             *
117:             * @return ServletConfig 	the <code>ServletConfig</code> object
118:             *				that initialized this servlet
119:             */
120:            public ServletConfig getServletConfig() {
121:                return config;
122:            }
123:
124:            /**
125:             * Returns a reference to the {@link ServletContext} in which this servlet
126:             * is running.  See {@link ServletConfig#getServletContext}.
127:             *
128:             * <p>This method is supplied for convenience. It gets the 
129:             * context from the servlet's <code>ServletConfig</code> object.
130:             *
131:             * @return ServletContext 	the <code>ServletContext</code> object
132:             *				passed to this servlet by the <code>init</code>
133:             *				method
134:             */
135:            public ServletContext getServletContext() {
136:                ServletConfig sc = getServletConfig();
137:                if (sc == null) {
138:                    throw new IllegalStateException(
139:                            "err.servlet_config_not_initialized");
140:                }
141:                return sc.getServletContext();
142:            }
143:
144:            /* (non-Javadoc)
145:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#preProcess(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
146:             */
147:            public void preProcess(HttpServletRequest req,
148:                    HttpServletResponse resp) throws ServletException,
149:                    IOException {
150:                // Some attributes needed by some or all JSPs
151:                req
152:                        .setAttribute(
153:                                "autorefresh", req.getParameter("autorefresh"));//$NON-NLS-1$ //$NON-NLS-2$
154:                req.setAttribute(
155:                        "WebFilesRoot", req.getContextPath() + webFilesRoot);//$NON-NLS-1$
156:            }
157:
158:            /* (non-Javadoc)
159:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#displayWebAppsList(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
160:             */
161:            public void displayWebAppsList(HttpServletRequest req,
162:                    HttpServletResponse resp,
163:                    Set/*<IApplicationInfo>*/applicationInfos)
164:                    throws ServletException, IOException {
165:                req.setAttribute("applications", applicationInfos);//$NON-NLS-1$
166:                getServletContext().getRequestDispatcher(webAppsListJspPath)
167:                        .include(req, resp);
168:            }
169:
170:            /* (non-Javadoc)
171:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#displaySessionsListPage(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
172:             */
173:            public void displaySessionsListPage(HttpServletRequest req,
174:                    HttpServletResponse resp, String sortBy, String orderBy,
175:                    IApplicationInfo webAppStats,
176:                    Collection/*<ISessionInfo>*/activeSessions,
177:                    Collection/*<String>*/passiveSessionsIds)
178:                    throws ServletException, IOException {
179:                // keep sort order
180:                req.setAttribute("sort", sortBy);//$NON-NLS-1$
181:                req.setAttribute("order", orderBy);//$NON-NLS-1$
182:                req.setAttribute("activeSessions", activeSessions);//$NON-NLS-1$
183:                req.setAttribute("passiveSessionsIds", passiveSessionsIds);//$NON-NLS-1$
184:                req.setAttribute("webAppStats", webAppStats);//$NON-NLS-1$
185:                getServletContext().getRequestDispatcher(sessionsListJspPath)
186:                        .include(req, resp);
187:            }
188:
189:            /* (non-Javadoc)
190:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#displaySessionDetailPage(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String)
191:             */
192:            public void displaySessionDetailPage(HttpServletRequest req,
193:                    HttpServletResponse resp, IApplicationInfo webAppStats,
194:                    ISessionInfo currentSession) throws ServletException,
195:                    IOException {
196:                req.setAttribute("webAppStats", webAppStats);//$NON-NLS-1$
197:                req.setAttribute("currentSession", currentSession);//$NON-NLS-1$
198:                getServletContext().getRequestDispatcher(sessionDetailJspPath)
199:                        .include(req, resp);
200:            }
201:
202:            /* (non-Javadoc)
203:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#displayWebAppStatsPage(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
204:             */
205:            public void displayWebAppStatsPage(HttpServletRequest req,
206:                    HttpServletResponse resp, IApplicationInfo webAppStats)
207:                    throws ServletException, IOException {
208:                req.setAttribute("webAppStats", webAppStats);//$NON-NLS-1$
209:                getServletContext().getRequestDispatcher(webAppStatsJspPath)
210:                        .include(req, resp);
211:            }
212:
213:            /* (non-Javadoc)
214:             * @see clime.messadmin.providers.spi.DisplayFormatProvider#displayServerInfosPage(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
215:             */
216:            public void displayServerInfosPage(HttpServletRequest req,
217:                    HttpServletResponse resp, IServerInfo serverInfo)
218:                    throws ServletException, IOException {
219:                req.setAttribute("serverInfos", serverInfo);//$NON-NLS-1$
220:                getServletContext().getRequestDispatcher(serverInfosJspPath)
221:                        .include(req, resp);
222:            }
223:
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.