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


001:        package com.jamontomcat;
002:
003:        /** Note this is simply a copy of com.jamonapi.http.JAMonTomcatValve. Tomcat 5.5 would not work with the valve in the same jar as the jamon classes
004:         * and also display stats in jamon.war.  Simply compile this class sepeartely and put it in tomcats /server/classes/com/jamontomcatvalve/http and put jamon-2.7.jar or higher in tomcats
005:         * common/lib directory.   Note this class should also work in tomcat 6 although it is easier simply to put jamon-2.7.jar (or higher in the server/lib)
006:         * for tomcat 6.
007:         * 
008:         *  <Valve className="com.jamonapi.http.JAMonTomcatValve"/>
009:         *   same as default above
010:         *    <Valve className="com.jamonapi.http.JAMonTomcatValve" summaryLabels="request.getRequestURI().ms, response.getContentCount().bytes, response.getStatus().value.httpStatus">
011:         *  <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"/>  
012:         * @author steve souza
013:         *
014:         */
015:
016:        //START tomcat 4/5
017:        /*
018:        
019:         Note I have not tested or run TomcatValves in tomcat 4 or 5, however they will work if coded
020:         in a manner similar to the following.
021:         // tomcat 4/5
022:         import org.apache.catalina.*;
023:         import org.apache.catalina.valves.*;
024:
025:         // use catalina.jar from tomcat4
026:
027:         public class JAMonTomcat55Valve extends org.apache.catalina.valves.ValveBase {
028:
029:         // tomcat 4/5
030:         public void invoke(Request request, Response response,  ValveContext valveContext) throws IOException, ServletException {
031:         start monitoring      
032:
033:         // tomcat 4/5
034:         if (valveContext!=null)
035:         valveContext.invokeNext(request, response);
036:
037:         stop monitoring
038:         }
039:
040:         */
041:
042:        import javax.servlet.*;
043:
044:        import org.apache.catalina.Valve;
045:        import java.io.IOException;
046:
047:        //START tomcat 5.5/6
048:        import org.apache.catalina.connector.Request;
049:        import org.apache.catalina.connector.Response;
050:        import com.jamonapi.http.*;
051:
052:        public class JAMonTomcat55Valve extends
053:                org.apache.catalina.valves.ValveBase {
054:            private static final String PREFIX = "com.jamontomcat.http.JAMonTomcat55Valve";
055:            private static final String DEFAULT_SUMMARY = "default, response.getContentCount().bytes, response.getStatus().value.httpStatus, request.contextpath.ms";
056:            HttpMonFactory httpMonFactory = new HttpMonFactory(PREFIX);
057:
058:            private final String jamonSummaryLabels = "default";
059:
060:            public JAMonTomcat55Valve() {
061:                setSummaryLabels(jamonSummaryLabels);
062:            }
063:
064:            /**
065:             * Extract the desired request property, and pass it (along with the
066:             * specified request and response objects) to the protected
067:             * <code>process()</code> method to perform the actual filtering.
068:             * This method must be implemented by a concrete subclass.
069:             *
070:             * @param request The servlet request to be processed
071:             * @param response The servlet response to be created
072:             *
073:             * @exception IOException if an input/output error occurs
074:             * @exception ServletException if a servlet error occurs
075:             * http://www.jdocs.com/tomcat/5.5.17/org/apache/catalina/valves/RequestFilterValve.html
076:             * 
077:             * log response, request to see what they do.
078:             * debug mode?
079:             * test xml - read property
080:             */
081:
082:            public void invoke(Request request, Response response)
083:                    throws IOException, ServletException {
084:                HttpMon httpMon = null;
085:                try {
086:                    httpMon = httpMonFactory.start(request, response);
087:
088:                    Valve nextValve = getNext();
089:                    if (nextValve != null)
090:                        nextValve.invoke(request, response);
091:
092:                } catch (Throwable e) {
093:                    httpMon.throwException(e);
094:                } finally {
095:                    httpMon.stop();
096:                }
097:
098:            }
099:
100:            public void setSummaryLabels(String jamonSummaryLabels) {
101:                httpMonFactory.setSummaryLabels(jamonSummaryLabels,
102:                        DEFAULT_SUMMARY);
103:            }
104:
105:            public String getSummaryLabels() {
106:                return httpMonFactory.getSummaryLabels();
107:            }
108:
109:            public void addSummaryLabel(String jamonSummaryLabel) {
110:                httpMonFactory.addSummaryLabel(jamonSummaryLabel);
111:
112:            }
113:
114:            public boolean getIgnoreHttpParams() {
115:                return httpMonFactory.getIgnoreHttpParams();
116:            }
117:
118:            public void setIgnoreHttpParams(boolean ignoreHttpParams) {
119:                httpMonFactory.setIgnoreHttpParams(ignoreHttpParams);
120:            }
121:
122:            public void setEnabled(boolean enable) {
123:                httpMonFactory.setEnabled(enable);
124:
125:            }
126:
127:            public int getSize() {
128:                return httpMonFactory.getSize();
129:            }
130:
131:            public boolean getEnabled() {
132:                return httpMonFactory.getEnabled();
133:            }
134:
135:            public void setSize(int size) {
136:                httpMonFactory.setSize(size);
137:
138:            }
139:
140:            public String getInfo() {
141:                return PREFIX;
142:            }
143:
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.