Source Code Cross Referenced for JAMonTomcatValve.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:        /** This valve works in tomcat 6 and jboss tomcat 5.5.  An alternative approach is to use the jamontomcat-2.7.jar and this approach is required for
004:         *  tomcat 4/5. The Valve architecture and signatures were changed between release 5 and 5.5. For tomcat 5.5
005:         *  this class should work in tomcats version of 5.5 but doesn't due to classloader issues.  Instead put com.jamontomcatvalve.http.JAMonTomcat55Valve
006:         *  in your server/classes/com/jamontomcat/http directory and put jamon's jar in common/lib.  This approach should also work in tomcat 6 
007:         *  though I didn't try it. This is a wrapper class for the true monitoring class of HttpMonFactory.
008:         *  
009:         *  Note
010:         *  <Engine name="Catalina" defaultHost="localhost" debug="0"><br>
011:         *     <Valve className="com.jamonapi.http.JAMonTomcatValve"/><br>
012:         <Valve className="com.jamontomcat.JAMonTomcat5Valve" size="10000" summaryLabels="default"/><br>
013:         *    <Valve className="com.jamonapi.http.JAMonTomcatValve" summaryLabels="request.getRequestURI().ms, response.getContentCount().bytes, response.getStatus().value.httpStatus"><br>
014:         *  <Valve className="com.jamonapi.http.JAMonTomcatValve  summaryLabels="request.getRequestURI().ms, request.getRequestURI().value.ms, response.getContentCount().pageBytes,response.getStatus().httpStatusCode, response.getStatus().value.httpStatusCode,     response.getContentType().value.type"/> <br> 
015:         * @author steve souza
016:         *
017:         */
018:
019:        import javax.servlet.*;
020:
021:        import org.apache.catalina.Valve;
022:        import java.io.IOException;
023:
024:        import org.apache.catalina.connector.Request;
025:        import org.apache.catalina.connector.Response;
026:
027:        public class JAMonTomcatValve extends
028:                org.apache.catalina.valves.ValveBase implements  HttpMonManage {
029:
030:            private static final String PREFIX = "com.jamonapi.http.JAMonTomcatValve";
031:            private static final String DEFAULT_SUMMARY = "default, response.getContentCount().bytes, response.getStatus().value.httpStatus, request.contextpath.ms";
032:            private HttpMonFactory httpMonFactory = new HttpMonFactory(PREFIX);
033:
034:            private final String jamonSummaryLabels = "default";
035:
036:            public JAMonTomcatValve() {
037:                setSummaryLabels(jamonSummaryLabels);
038:            }
039:
040:            /**
041:             * Extract the desired request property, and pass it (along with the
042:             * specified request and response objects) to the protected
043:             * <code>process()</code> method to perform the actual filtering.
044:             * This method must be implemented by a concrete subclass.
045:             *
046:             * @param request The servlet request to be processed
047:             * @param response The servlet response to be created
048:             *
049:             * @exception IOException if an input/output error occurs
050:             * @exception ServletException if a servlet error occurs
051:             * http://www.jdocs.com/tomcat/5.5.17/org/apache/catalina/valves/RequestFilterValve.html
052:             * 
053:             * log response, request to see what they do.
054:             * debug mode?
055:             * test xml - read property
056:             */
057:
058:            public void invoke(Request request, Response response)
059:                    throws IOException, ServletException {
060:                HttpMon httpMon = null;
061:                try {
062:                    httpMon = httpMonFactory.start(request, response);
063:
064:                    Valve nextValve = getNext();
065:                    if (nextValve != null)
066:                        nextValve.invoke(request, response);
067:
068:                } catch (Throwable e) {
069:                    httpMon.throwException(e);
070:                } finally {
071:                    httpMon.stop();
072:                }
073:
074:            }
075:
076:            public void setSummaryLabels(String jamonSummaryLabels) {
077:                httpMonFactory.setSummaryLabels(jamonSummaryLabels,
078:                        DEFAULT_SUMMARY);
079:            }
080:
081:            public String getSummaryLabels() {
082:                return httpMonFactory.getSummaryLabels();
083:            }
084:
085:            public void addSummaryLabel(String jamonSummaryLabel) {
086:                httpMonFactory.addSummaryLabel(jamonSummaryLabel);
087:
088:            }
089:
090:            public boolean getIgnoreHttpParams() {
091:                return httpMonFactory.getIgnoreHttpParams();
092:            }
093:
094:            public void setIgnoreHttpParams(boolean ignoreHttpParams) {
095:                httpMonFactory.setIgnoreHttpParams(ignoreHttpParams);
096:            }
097:
098:            public void setEnabled(boolean enable) {
099:                httpMonFactory.setEnabled(enable);
100:
101:            }
102:
103:            public int getSize() {
104:                return httpMonFactory.getSize();
105:            }
106:
107:            public boolean getEnabled() {
108:                return httpMonFactory.getEnabled();
109:            }
110:
111:            public void setSize(int size) {
112:                httpMonFactory.setSize(size);
113:
114:            }
115:
116:            public String getInfo() {
117:                return PREFIX;
118:            }
119:
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.