Source Code Cross Referenced for JAMonJettyHandler.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) 


01:        package com.jamonapi.http;
02:
03:        /** Handler that can be used to track request access in jetty.  See www.jamonapi.com for more info on how to
04:         * add this handler to the jetty.xml file.  This is a wrapper class for the true monitoring class of HttpMonFactory.
05:         * 
06:         */
07:        import java.io.IOException;
08:
09:        import javax.servlet.ServletException;
10:        import javax.servlet.http.HttpServletRequest;
11:        import javax.servlet.http.HttpServletResponse;
12:
13:        import org.mortbay.jetty.HttpConnection;
14:        import org.mortbay.jetty.Request;
15:        import org.mortbay.jetty.Response;
16:        import org.mortbay.jetty.handler.HandlerWrapper;
17:
18:        public class JAMonJettyHandler extends HandlerWrapper implements 
19:                HttpMonManage {
20:
21:            private static final String PREFIX = "com.jamonapi.http.JAMonJettyHandler";
22:            private static final String DEFAULT_SUMMARY = "default, response.getContentCount().bytes, response.getStatus().value.ms";
23:            private HttpMonFactory httpMonFactory = new JettyHttpMonFactory(
24:                    PREFIX);
25:            private String jamonSummaryLabels = "default";
26:
27:            public JAMonJettyHandler() {
28:                setSummaryLabels(jamonSummaryLabels);
29:            }
30:
31:            /** Monitor the request and call any other requests in the decorator chain */
32:            public void handle(String target, HttpServletRequest request,
33:                    HttpServletResponse response, int dispatch)
34:                    throws IOException, ServletException {
35:                final Request baseRequest = (request instanceof  Request) ? ((Request) request)
36:                        : HttpConnection.getCurrentConnection().getRequest();
37:                final Response baseResponse = (response instanceof  Response) ? ((Response) response)
38:                        : HttpConnection.getCurrentConnection().getResponse();
39:
40:                HttpMon httpMon = null;
41:                try {
42:                    httpMon = httpMonFactory.start(baseRequest, baseResponse);
43:
44:                    super .handle(target, request, response, dispatch);
45:                } catch (Throwable e) {
46:                    httpMon.throwException(e);
47:                } finally {
48:                    httpMon.stop();
49:                }
50:
51:            }
52:
53:            public void setSummaryLabels(String jamonSummaryLabels) {
54:                httpMonFactory.setSummaryLabels(jamonSummaryLabels,
55:                        DEFAULT_SUMMARY);
56:            }
57:
58:            public String getSummaryLabels() {
59:                return httpMonFactory.getSummaryLabels();
60:            }
61:
62:            public void addSummaryLabel(String jamonSummaryLabel) {
63:                httpMonFactory.addSummaryLabel(jamonSummaryLabel);
64:
65:            }
66:
67:            public boolean getIgnoreHttpParams() {
68:                return httpMonFactory.getIgnoreHttpParams();
69:            }
70:
71:            public void setIgnoreHttpParams(boolean ignoreHttpParams) {
72:                httpMonFactory.setIgnoreHttpParams(ignoreHttpParams);
73:            }
74:
75:            public void setEnabled(boolean enable) {
76:                httpMonFactory.setEnabled(enable);
77:
78:            }
79:
80:            public int getSize() {
81:                return httpMonFactory.getSize();
82:            }
83:
84:            public boolean getEnabled() {
85:                return httpMonFactory.getEnabled();
86:            }
87:
88:            public void setSize(int size) {
89:                httpMonFactory.setSize(size);
90:
91:            }
92:
93:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.