Source Code Cross Referenced for RequestHandledEvent.java in  » J2EE » spring-framework-2.5 » org » springframework » web » context » support » 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 » J2EE » spring framework 2.5 » org.springframework.web.context.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.web.context.support;
018:
019:        import org.springframework.context.ApplicationEvent;
020:
021:        /**
022:         * Event raised when a request is handled within an ApplicationContext.
023:         *
024:         * <p>Supported by Spring's own FrameworkServlet (through a specific
025:         * ServletRequestHandledEvent subclass), but can also be raised by any
026:         * other web component. Used, for example, by Spring's out-of-the-box
027:         * PerformanceMonitorListener.
028:         *
029:         * @author Rod Johnson
030:         * @author Juergen Hoeller
031:         * @since January 17, 2001
032:         * @see ServletRequestHandledEvent
033:         * @see PerformanceMonitorListener
034:         * @see org.springframework.web.servlet.FrameworkServlet
035:         * @see org.springframework.context.ApplicationContext#publishEvent
036:         */
037:        public class RequestHandledEvent extends ApplicationEvent {
038:
039:            /** Session id that applied to the request, if any */
040:            private String sessionId;
041:
042:            /** Usually the UserPrincipal */
043:            private String userName;
044:
045:            /** Request processing time */
046:            private final long processingTimeMillis;
047:
048:            /** Cause of failure, if any */
049:            private Throwable failureCause;
050:
051:            /**
052:             * Create a new RequestHandledEvent with session information.
053:             * @param source the component that published the event
054:             * @param sessionId the id of the HTTP session, if any
055:             * @param userName the name of the user that was associated with the
056:             * request, if any (usually the UserPrincipal)
057:             * @param processingTimeMillis the processing time of the request in milliseconds
058:             */
059:            public RequestHandledEvent(Object source, String sessionId,
060:                    String userName, long processingTimeMillis) {
061:                super (source);
062:                this .sessionId = sessionId;
063:                this .userName = userName;
064:                this .processingTimeMillis = processingTimeMillis;
065:            }
066:
067:            /**
068:             * Create a new RequestHandledEvent with session information.
069:             * @param source the component that published the event
070:             * @param sessionId the id of the HTTP session, if any
071:             * @param userName the name of the user that was associated with the
072:             * request, if any (usually the UserPrincipal)
073:             * @param processingTimeMillis the processing time of the request in milliseconds
074:             * @param failureCause the cause of failure, if any
075:             */
076:            public RequestHandledEvent(Object source, String sessionId,
077:                    String userName, long processingTimeMillis,
078:                    Throwable failureCause) {
079:
080:                this (source, sessionId, userName, processingTimeMillis);
081:                this .failureCause = failureCause;
082:            }
083:
084:            /**
085:             * Return the processing time of the request in milliseconds.
086:             */
087:            public long getProcessingTimeMillis() {
088:                return this .processingTimeMillis;
089:            }
090:
091:            /**
092:             * Return the id of the HTTP session, if any.
093:             */
094:            public String getSessionId() {
095:                return this .sessionId;
096:            }
097:
098:            /**
099:             * Return the name of the user that was associated with the request
100:             * (usually the UserPrincipal).
101:             * @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
102:             */
103:            public String getUserName() {
104:                return this .userName;
105:            }
106:
107:            /**
108:             * Return whether the request failed.
109:             */
110:            public boolean wasFailure() {
111:                return (this .failureCause != null);
112:            }
113:
114:            /**
115:             * Return the cause of failure, if any.
116:             */
117:            public Throwable getFailureCause() {
118:                return this .failureCause;
119:            }
120:
121:            /**
122:             * Return a short description of this event, only involving
123:             * the most important context data.
124:             */
125:            public String getShortDescription() {
126:                StringBuffer sb = new StringBuffer();
127:                sb.append("session=[").append(this .sessionId).append("]; ");
128:                sb.append("user=[").append(this .userName).append("]; ");
129:                return sb.toString();
130:            }
131:
132:            /**
133:             * Return a full description of this event, involving
134:             * all available context data.
135:             */
136:            public String getDescription() {
137:                StringBuffer sb = new StringBuffer();
138:                sb.append("session=[").append(this .sessionId).append("]; ");
139:                sb.append("user=[").append(this .userName).append("]; ");
140:                sb.append("time=[").append(this .processingTimeMillis).append(
141:                        "ms]; ");
142:                sb.append("status=[");
143:                if (!wasFailure()) {
144:                    sb.append("OK");
145:                } else {
146:                    sb.append("failed: ").append(this .failureCause);
147:                }
148:                sb.append(']');
149:                return sb.toString();
150:            }
151:
152:            public String toString() {
153:                return ("RequestHandledEvent: " + getDescription());
154:            }
155:
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.