Source Code Cross Referenced for JAMonServletFilter.java in  » Profiler » JAMon » com » jamonapi » http » 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 » JAMon » com.jamonapi.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.jamonapi.http;
002:
003:        import java.io.IOException;
004:
005:        import javax.servlet.Filter;
006:        import javax.servlet.FilterChain;
007:        import javax.servlet.FilterConfig;
008:        import javax.servlet.ServletException;
009:        import javax.servlet.ServletRequest;
010:        import javax.servlet.ServletResponse;
011:        import javax.servlet.http.HttpServlet;
012:
013:        /** Note this servlet filter is more functional than com.jamonapi.JAMonFilter, but either can be used.   
014:         * This is a wrapper class for the true monitoring class of HttpMonFactory.
015:         * 
016:         * <web-app>
017:         <display-name>jamon</display-name>
018:         <filter>
019:         <filter-name>JAMonServletFilter</filter-name>
020:         <filter-class>com.jamonapi.http.JAMonServletFilter</filter-class>
021:         </filter>
022:        
023:         <filter-mapping>
024:         <filter-name>JAMonServletFilter</filter-name>
025:         <url-pattern>*</url-pattern>
026:         </filter-mapping>
027:         */
028:        public class JAMonServletFilter extends HttpServlet implements 
029:                HttpMonManage, Filter {
030:
031:            private static final long serialVersionUID = 27L;
032:
033:            private static final String PREFIX = "com.jamonapi.http.JAMonServletFilter";
034:            private HttpMonFactory httpMonFactory = new HttpMonFactory(PREFIX);
035:
036:            private final String jamonSummaryLabels = "request.getRequestURI().ms as allPages, request.getRequestURI().value.ms as page, request.contextpath.ms";
037:
038:            public JAMonServletFilter() {
039:                setSummaryLabels(jamonSummaryLabels);
040:            }
041:
042:            /** Servlet filter method that does the monitoring */
043:
044:            public void doFilter(ServletRequest request,
045:                    ServletResponse response, FilterChain filterChain)
046:                    throws IOException, ServletException {
047:                HttpMon httpMon = null;
048:                try {
049:                    httpMon = httpMonFactory.start(request, response);
050:                    filterChain.doFilter(request, response);
051:                } catch (Throwable e) {
052:                    httpMon.throwException(e);
053:                } finally {
054:                    httpMon.stop();
055:                }
056:            }
057:
058:            public void setSummaryLabels(String jamonSummaryLabels) {
059:                httpMonFactory.setSummaryLabels(jamonSummaryLabels);
060:            }
061:
062:            public String getSummaryLabels() {
063:                return httpMonFactory.getSummaryLabels();
064:            }
065:
066:            public void addSummaryLabel(String jamonSummaryLabel) {
067:                httpMonFactory.addSummaryLabel(jamonSummaryLabel);
068:
069:            }
070:
071:            public boolean getIgnoreHttpParams() {
072:                return httpMonFactory.getIgnoreHttpParams();
073:            }
074:
075:            public void setIgnoreHttpParams(boolean ignoreHttpParams) {
076:                httpMonFactory.setIgnoreHttpParams(ignoreHttpParams);
077:            }
078:
079:            public void setEnabled(boolean enable) {
080:                httpMonFactory.setEnabled(enable);
081:
082:            }
083:
084:            public int getSize() {
085:                return httpMonFactory.getSize();
086:            }
087:
088:            public boolean getEnabled() {
089:                return httpMonFactory.getEnabled();
090:            }
091:
092:            public void setSize(int size) {
093:                httpMonFactory.setSize(size);
094:
095:            }
096:
097:            public void init(FilterConfig arg0) throws ServletException {
098:
099:            }
100:
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.