Source Code Cross Referenced for ServletException.java in  » Ajax » zk » org » zkoss » web » servlet » 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 » Ajax » zk » org.zkoss.web.servlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ServletException.java
002:
003:        {{IS_NOTE
004:        	Purpose: 
005:        	Description: 
006:        	History:
007:        		2001/11/13 20:17:38, Create, Tom M. Yeh.
008:        }}IS_NOTE
009:
010:        Copyright (C) 2001 Potix Corporation. All Rights Reserved.
011:
012:        {{IS_RIGHT
013:        	This program is distributed under GPL Version 2.0 in the hope that
014:        	it will be useful, but WITHOUT ANY WARRANTY.
015:        }}IS_RIGHT
016:         */
017:        package org.zkoss.web.servlet;
018:
019:        import org.zkoss.lang.Expectable;
020:        import org.zkoss.lang.Exceptions;
021:        import org.zkoss.mesg.Messageable;
022:
023:        /**
024:         * Potix version of ServletException. It extends
025:         * javax.servlet.ServletException to provide error codes and other features.
026:         *
027:         * @author tomyeh
028:         */
029:        public class ServletException extends javax.servlet.ServletException
030:                implements  Messageable {
031:            /** Utilities.
032:             *
033:             * <p>The reason to use a class to hold static utilities is we can
034:             * override the method's return type later.
035:             */
036:            public static class Aide {
037:                /** Converts an exception to ServletException or OperationException
038:                 * depending on whether t implements Expetable.
039:                 * @see Exceptions#wrap
040:                 */
041:                public static javax.servlet.ServletException wrap(Throwable t) {
042:                    t = Exceptions.unwrap(t);
043:                    if (t instanceof  javax.servlet.ServletException)
044:                        return (javax.servlet.ServletException) t;
045:                    if (t instanceof  Expectable)
046:                        return (OperationException) Exceptions.wrap(t,
047:                                OperationException.class);
048:                    return (ServletException) Exceptions.wrap(t,
049:                            ServletException.class);
050:                }
051:
052:                /** Converts an exception to ServletException or OperationException
053:                 * depending on whether t implements Expetable.
054:                 * @see Exceptions#wrap
055:                 */
056:                public static ServletException wrap(Throwable t, String msg) {
057:                    t = Exceptions.unwrap(t);
058:                    if (t instanceof  Expectable)
059:                        return (OperationException) Exceptions.wrap(t,
060:                                OperationException.class, msg);
061:                    return (ServletException) Exceptions.wrap(t,
062:                            ServletException.class, msg);
063:                }
064:
065:                /** Converts an exception to ServletException or OperationException
066:                 * depending on whether t implements Expetable.
067:                 * @see Exceptions#wrap
068:                 */
069:                public static ServletException wrap(Throwable t, int code,
070:                        Object[] fmtArgs) {
071:                    t = Exceptions.unwrap(t);
072:                    if (t instanceof  Expectable)
073:                        return (OperationException) Exceptions.wrap(t,
074:                                OperationException.class, code, fmtArgs);
075:                    return (ServletException) Exceptions.wrap(t,
076:                            ServletException.class, code, fmtArgs);
077:                }
078:
079:                /** Converts an exception to ServletException or OperationException
080:                 * depending on whether t implements Expetable.
081:                 * @see Exceptions#wrap
082:                 */
083:                public static ServletException wrap(Throwable t, int code,
084:                        Object fmtArg) {
085:                    t = Exceptions.unwrap(t);
086:                    if (t instanceof  Expectable)
087:                        return (OperationException) Exceptions.wrap(t,
088:                                OperationException.class, code, fmtArg);
089:                    return (ServletException) Exceptions.wrap(t,
090:                            ServletException.class, code, fmtArg);
091:                }
092:
093:                /** Converts an exception to ServletException or OperationException
094:                 * depending on whether t implements Expetable.
095:                 * @see Exceptions#wrap
096:                 */
097:                public static ServletException wrap(Throwable t, int code) {
098:                    t = Exceptions.unwrap(t);
099:                    if (t instanceof  Expectable)
100:                        return (OperationException) Exceptions.wrap(t,
101:                                OperationException.class, code);
102:                    return (ServletException) Exceptions.wrap(t,
103:                            ServletException.class, code);
104:                }
105:            }
106:
107:            protected int _code = NULL_CODE;
108:
109:            public ServletException(String msg, Throwable cause) {
110:                super (msg, cause);
111:            }
112:
113:            public ServletException(String msg) {
114:                super (msg);
115:            }
116:
117:            public ServletException(int code, Object[] fmtArgs, Throwable cause) {
118:                super (Exceptions.getMessage(code, fmtArgs), cause);
119:                _code = code;
120:            }
121:
122:            public ServletException(int code, Object fmtArg, Throwable cause) {
123:                super (Exceptions.getMessage(code, fmtArg), cause);
124:                _code = code;
125:            }
126:
127:            public ServletException(int code, Object[] fmtArgs) {
128:                super (Exceptions.getMessage(code, fmtArgs));
129:                _code = code;
130:            }
131:
132:            public ServletException(int code, Object fmtArg) {
133:                super (Exceptions.getMessage(code, fmtArg));
134:                _code = code;
135:            }
136:
137:            public ServletException(int code, Throwable cause) {
138:                super (Exceptions.getMessage(code, null), cause);
139:                _code = code;
140:            }
141:
142:            public ServletException(int code) {
143:                super (Exceptions.getMessage(code, null));
144:                _code = code;
145:            }
146:
147:            public ServletException(Throwable cause) {
148:                super (cause);
149:            }
150:
151:            public ServletException() {
152:            }
153:
154:            //-- Messageable --//
155:            public final int getCode() {
156:                return _code;
157:            }
158:
159:            //-- override --//
160:            private transient boolean _getCause = false;
161:
162:            public Throwable getCause() {
163:                //The case: ServletException implements getRootCause
164:                //by returning getCause -> it causes a dead loop
165:                if (_getCause) //recursive back?
166:                    return null;
167:
168:                //The case: ServletException has implemented getCause (1.4-ware)
169:                Throwable t = super .getCause();
170:                if (t != null)
171:                    return t;
172:
173:                try {
174:                    _getCause = true;
175:                    return getRootCause();
176:                } finally {
177:                    _getCause = false;
178:                }
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.