Java Doc for ExceptionHandler.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » action » 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 » Web Framework » struts 1.3.8 » org.apache.struts.action 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.struts.action.ExceptionHandler

ExceptionHandler
public class ExceptionHandler (Code)

An ExceptionHandler is configured in the Struts configuration file to handle a specific type of exception thrown by an Action.execute method.


since:
   Struts 1.1


Field Summary
final public static  StringINCLUDE_PATH
    

The name of a configuration property which can be set to specify an alternative path which should be used when the HttpServletResponse has already been committed.

To use this, in your struts-config.xml specify the exception handler like this:

 <exception
 key="GlobalExceptionHandler.default"
 type="java.lang.Exception"
 path="/ErrorPage.jsp">
 <set-property key="INCLUDE_PATH" value="/error.jsp" />
 </exception>
 

You would want to use this when your normal ExceptionHandler path is a Tiles definition or otherwise unsuitable for use in an include context.

final public static  StringSILENT_IF_COMMITTED
    

The name of a configuration property which indicates that Struts should do nothing if the response has already been committed.



Method Summary
protected  StringdetermineIncludePath(ExceptionConfig config, ActionForward actionForward)
    

Return a path to which an include should be attempted in the case when the response was committed before the ExceptionHandler was invoked.

public  ActionForwardexecute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response)
    

Handle the Exception.

protected  voidhandleCommittedResponse(Exception ex, ExceptionConfig config, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response, ActionForward actionForward)
    

Attempt to give good information when the response has already been committed when the exception was thrown.

protected  voidlogException(Exception e)
    
protected  voidstoreException(HttpServletRequest request, String property, ActionMessage error, ActionForward forward, String scope)
    

Default implementation for handling an ActionMessage generated from an Exception during Action delegation.


Field Detail
INCLUDE_PATH
final public static String INCLUDE_PATH(Code)

The name of a configuration property which can be set to specify an alternative path which should be used when the HttpServletResponse has already been committed.

To use this, in your struts-config.xml specify the exception handler like this:

 <exception
 key="GlobalExceptionHandler.default"
 type="java.lang.Exception"
 path="/ErrorPage.jsp">
 <set-property key="INCLUDE_PATH" value="/error.jsp" />
 </exception>
 

You would want to use this when your normal ExceptionHandler path is a Tiles definition or otherwise unsuitable for use in an include context. If you do not use this, and you do not specify "SILENT_IF_COMMITTED" then the ExceptionHandler will attempt to forward to the same path which would be used in normal circumstances, specified using the "path" attribute in the <exception> element.


since:
   Struts 1.3



SILENT_IF_COMMITTED
final public static String SILENT_IF_COMMITTED(Code)

The name of a configuration property which indicates that Struts should do nothing if the response has already been committed. This suppresses the default behavior, which is to use an "include" rather than a "forward" in this case in hopes of providing some meaningful information to the browser.

To use this, in your struts-config.xml specify the exception handler like this:

 <exception
 key="GlobalExceptionHandler.default"
 type="java.lang.Exception"
 path="/ErrorPage.jsp">
 <set-property key="SILENT_IF_COMMITTED" value="true" />
 </exception>
 
To be effective, this value must be defined to the literal String "true". If it is not defined or defined to any other value, the default behavior will be used.

You only need to use this if you do not want error information displayed in the browser when Struts intercepts an exception after the response has been committed.


since:
   Struts 1.3





Method Detail
determineIncludePath
protected String determineIncludePath(ExceptionConfig config, ActionForward actionForward)(Code)

Return a path to which an include should be attempted in the case when the response was committed before the ExceptionHandler was invoked.

If the ExceptionConfig has the property INCLUDE_PATH defined, then the value of that property will be returned. Otherwise, the ActionForward path is returned.


Parameters:
  config - Configuration element
Parameters:
  actionForward - Forward to use on error Path of resource to include
since:
   Struts 1.3



execute
public ActionForward execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException(Code)

Handle the Exception. Return the ActionForward instance (if any) returned by the called ExceptionHandler.


Parameters:
  ex - The exception to handle
Parameters:
  ae - The ExceptionConfig corresponding to the exception
Parameters:
  mapping - The ActionMapping we are processing
Parameters:
  formInstance - The ActionForm we are processing
Parameters:
  request - The servlet request we are processing
Parameters:
  response - The servlet response we are creating The ActionForward instance (if any) returned bythe called ExceptionHandler.
throws:
  ServletException - if a servlet exception occurs
since:
   Struts 1.1



handleCommittedResponse
protected void handleCommittedResponse(Exception ex, ExceptionConfig config, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response, ActionForward actionForward)(Code)

Attempt to give good information when the response has already been committed when the exception was thrown. This happens often when Tiles is used. Base implementation will see if the INCLUDE_PATH property has been set, or if not, it will attempt to use the same path to which control would have been forwarded.


Parameters:
  ex - The exception to handle
Parameters:
  config - The ExceptionConfig we are processing
Parameters:
  mapping - The ActionMapping we are processing
Parameters:
  formInstance - The ActionForm we are processing
Parameters:
  request - The servlet request we are processing
Parameters:
  response - The servlet response we are creating
Parameters:
  actionForward - The ActionForward we are processing
since:
   Struts 1.3



logException
protected void logException(Exception e)(Code)

Logs the Exception using commons-logging.


Parameters:
  e - The Exception to LOG.
since:
   Struts 1.2



storeException
protected void storeException(HttpServletRequest request, String property, ActionMessage error, ActionForward forward, String scope)(Code)

Default implementation for handling an ActionMessage generated from an Exception during Action delegation. The default implementation is to set an attribute of the request or session, as defined by the scope provided (the scope from the exception mapping). An ActionMessages instance is created, the error is added to the collection and the collection is set under the Globals.ERROR_KEY.


Parameters:
  request - The request we are handling
Parameters:
  property - The property name to use for this error
Parameters:
  error - The error generated from the exception mapping
Parameters:
  forward - The forward generated from the input path (from theform or exception mapping)
Parameters:
  scope - The scope of the exception mapping.
since:
   Struts 1.2



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.