Source Code Cross Referenced for ExceptionErrorPage.java in  » J2EE » wicket » wicket » markup » html » pages » 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 » wicket » wicket.markup.html.pages 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ExceptionErrorPage.java 459117 2006-02-09 13:16:04Z jcompagner $
003:         * $Revision: 459117 $ $Date: 2006-02-09 14:16:04 +0100 (Thu, 09 Feb 2006) $
004:         * 
005:         * ==============================================================================
006:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
007:         * use this file except in compliance with the License. You may obtain a copy of
008:         * the License at
009:         * 
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015:         * License for the specific language governing permissions and limitations under
016:         * the License.
017:         */
018:        package wicket.markup.html.pages;
019:
020:        import javax.servlet.http.HttpServletResponse;
021:
022:        import wicket.Page;
023:        import wicket.markup.MarkupException;
024:        import wicket.markup.MarkupStream;
025:        import wicket.markup.html.WebMarkupContainer;
026:        import wicket.markup.html.WebPage;
027:        import wicket.markup.html.basic.Label;
028:        import wicket.markup.html.basic.MultiLineLabel;
029:        import wicket.markup.html.debug.PageView;
030:        import wicket.util.string.Strings;
031:
032:        /**
033:         * Shows a runtime exception on a nice HTML page.
034:         * 
035:         * @author Jonathan Locke
036:         */
037:        public class ExceptionErrorPage extends WebPage {
038:            private static final long serialVersionUID = 1L;
039:
040:            /** Keep a reference to the root cause. WicketTester will use it */
041:            private transient Throwable throwable;
042:
043:            /**
044:             * Constructor.
045:             * 
046:             * @param throwable
047:             *            The exception to show
048:             * @param page
049:             *            The page being rendered when the exception was thrown
050:             */
051:            public ExceptionErrorPage(final Throwable throwable, final Page page) {
052:                this .throwable = throwable;
053:
054:                // Add exception label
055:                add(new MultiLineLabel("exception", Strings.toString(throwable)));
056:
057:                // Get values
058:                String resource = "";
059:                String markup = "";
060:                MarkupStream markupStream = null;
061:
062:                if (throwable instanceof  MarkupException) {
063:                    markupStream = ((MarkupException) throwable)
064:                            .getMarkupStream();
065:
066:                    if (markupStream != null) {
067:                        markup = markupStream.toHtmlDebugString();
068:                        resource = markupStream.getResource().toString();
069:                    }
070:                }
071:
072:                // Create markup label
073:                final MultiLineLabel markupLabel = new MultiLineLabel("markup",
074:                        markup);
075:
076:                markupLabel.setEscapeModelStrings(false);
077:
078:                // Add container with markup highlighted
079:                final WebMarkupContainer markupHighlight = new WebMarkupContainer(
080:                        "markupHighlight");
081:
082:                markupHighlight.add(markupLabel);
083:                markupHighlight.add(new Label("resource", resource));
084:                add(markupHighlight);
085:
086:                // Show container if markup stream is available
087:                markupHighlight.setVisible(markupStream != null);
088:
089:                // Show component tree of the page
090:                if (page != null) {
091:                    add(new PageView("componentTree", page));
092:                } else {
093:                    add(new Label("componentTree", ""));
094:                }
095:            }
096:
097:            /**
098:             * @see wicket.markup.html.WebPage#configureResponse()
099:             */
100:            protected void configureResponse() {
101:                super .configureResponse();
102:                getWebRequestCycle()
103:                        .getWebResponse()
104:                        .getHttpServletResponse()
105:                        .setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
106:            }
107:
108:            /**
109:             * Get access to the exception
110:             * 
111:             * @return The exception
112:             */
113:            public Throwable getThrowable() {
114:                return throwable;
115:            }
116:
117:            /**
118:             * @see wicket.Page#isErrorPage()
119:             */
120:            public boolean isErrorPage() {
121:                return true;
122:            }
123:
124:            /**
125:             * @see wicket.Component#isVersioned()
126:             */
127:            public boolean isVersioned() {
128:                return false;
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.