Source Code Cross Referenced for ErrorData.java in  » Profiler » MessAdmin » clime » messadmin » model » 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 » MessAdmin » clime.messadmin.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //package javax.servlet.jsp;
002:        package clime.messadmin.model;
003:
004:        import java.io.Serializable;
005:        import java.util.Date;
006:
007:        import javax.servlet.ServletRequest;
008:        import javax.servlet.http.HttpServletRequest;
009:
010:        import clime.messadmin.utils.SessionUtils;
011:
012:        /**
013:         * Contains information about an error, for error pages. The information
014:         * contained in this instance is meaningless if not used in the context of an
015:         * error page. To indicate a JSP is an error page, the page author must set the
016:         * isErrorPage attribute of the page directive to "true".
017:         * 
018:         * @see javax.servlet.jsp.PageContext#getErrorData
019:         * @since JSP 2.0
020:         * @author Cédrik LIME
021:         */
022:        public final class ErrorData implements  Serializable {
023:
024:            protected Throwable throwable;
025:            //	protected int statusCode;
026:            protected String uri;
027:            //	protected String servletName;
028:
029:            private long date;
030:
031:            /**
032:             * Creates a new ErrorData object.
033:             * 
034:             * @param throwable    The Throwable that is the cause of the error
035:             * @param statusCode   The status code of the error
036:             * @param uri          The request URI
037:             * @param servletName  The name of the servlet invoked
038:             */
039:            public ErrorData(Throwable throwable, int statusCode, String uri,
040:                    String servletName) {
041:                this .throwable = throwable;
042:                //		this.statusCode = statusCode;
043:                this .uri = uri;
044:                //		this.servletName = servletName;
045:                this .date = System.currentTimeMillis();
046:            }
047:
048:            /**
049:             * Creates a new ErrorData object.
050:             * 
051:             * @param request  The ServletRequest to extract information from
052:             */
053:            public ErrorData(ServletRequest request) {
054:                // Servlet 2.2
055:                //		Integer statusCodeInt = (Integer) request.getAttribute("javax.servlet.error.status_code");
056:                //		this.statusCode = (statusCodeInt == null ? 0 : statusCodeInt.intValue());//$NON-NLS-1$
057:                /*
058:                 * With the introduction of the exception object to the attributes list for version
059:                 * 2.3 of this specification, the exception type and error message attributes are
060:                 * redundant. They are retained for backwards compatibility with earlier versions of
061:                 * the API.
062:                 */
063:                //Class exceptionType = (Class) request.getAttribute("javax.servlet.error.exception_type");//$NON-NLS-1$
064:                /** the exception message, passed to the exception constructor */
065:                //String message = (String) request.getAttribute("javax.servlet.error.message");//$NON-NLS-1$
066:                // Servlet 2.3
067:                this .throwable = (Throwable) request
068:                        .getAttribute("javax.servlet.error.exception");//$NON-NLS-1$
069:                if (this .throwable == null) {
070:                    this .throwable = (Throwable) request
071:                            .getAttribute("javax.servlet.jsp.jspException");//$NON-NLS-1$
072:                }
073:                this .uri = (String) request
074:                        .getAttribute("javax.servlet.error.request_uri");//$NON-NLS-1$
075:                //		this.servletName = (String) request.getAttribute("javax.servlet.error.servlet_name");//$NON-NLS-1$
076:                this .date = System.currentTimeMillis();
077:            }
078:
079:            /**
080:             * Creates a new ErrorData object.
081:             * 
082:             * @param request  The ServletRequest to extract information from
083:             * @param t        The Throwable that is the cause of the error
084:             */
085:            public ErrorData(HttpServletRequest request, Throwable t) {
086:                this (request);
087:                if (throwable == null) {
088:                    throwable = t;
089:                }
090:                if (uri == null) {
091:                    uri = SessionUtils
092:                            .getRequestURLWithMethodAndQueryString(request);
093:                }
094:                //		if (statusCode == 0) {
095:                //			statusCode = response.getStatus();
096:                //		}
097:            }
098:
099:            /**
100:             * Returns the Throwable that caused the error.
101:             * 
102:             * @return The Throwable that caused the error
103:             */
104:            public Throwable getThrowable() {
105:                return throwable;
106:            }
107:
108:            /**
109:             * Returns the status code of the error.
110:             * 
111:             * @return The status code of the error
112:             */
113:            //	public int getStatusCode() {
114:            //		return statusCode;
115:            //	}
116:            /**
117:             * Returns the request URI.
118:             * 
119:             * @return The request URI
120:             */
121:            public String getRequestURI() {
122:                return uri;
123:            }
124:
125:            /**
126:             * Returns the name of the servlet invoked.
127:             * 
128:             * @return The name of the servlet invoked
129:             */
130:            //	public String getServletName() {
131:            //		return servletName;
132:            //	}
133:            /**
134:             * @return Returns the date.
135:             */
136:            public Date getDate() {
137:                return new Date(date);
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.