Java Doc for SimpleMappingExceptionResolver.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » portlet » handler » 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.0.6 » org.springframework.web.portlet.handler 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.web.portlet.handler.SimpleMappingExceptionResolver

SimpleMappingExceptionResolver
public class SimpleMappingExceptionResolver implements HandlerExceptionResolver,Ordered(Code)
org.springframework.web.portlet.HandlerExceptionResolver implementation that allows for mapping exception class names to view names, either for a set of given handlers or for all handlers in the DispatcherPortlet.

Error views are analogous to error page JSPs, but can be used with any kind of exception including any checked one, with fine-granular mappings for specific handlers.
author:
   Juergen Hoeller
author:
   John A. Lewis
since:
   2.0



Field Summary
final public static  StringDEFAULT_EXCEPTION_ATTRIBUTE
     The default name of the exception attribute: "exception".
final protected  Loglogger
    


Method Summary
protected  StringbuildLogMessage(Exception ex, RenderRequest request)
     Build a log message for the given exception, occured during processing the given request.
protected  StringdetermineViewName(Exception ex, RenderRequest request)
     Determine the view name for the given exception, searching the SimpleMappingExceptionResolver.setExceptionMappings "exceptionMappings" , using the SimpleMappingExceptionResolver.setDefaultErrorView "defaultErrorView" as fallback.
protected  ModelAndViewdoResolveException(RenderRequest request, RenderResponse response, Object handler, Exception ex)
     Actually resolve the given exception that got thrown during on handler execution, returning a ModelAndView that represents a specific error page if appropriate.
protected  StringfindMatchingViewName(Properties exceptionMappings, Exception ex)
    
protected  intgetDepth(String exceptionMapping, Exception ex)
     Return the depth to the superclass matching.

0 means ex matches exactly.

protected  ModelAndViewgetModelAndView(String viewName, Exception ex, RenderRequest request)
     Return a ModelAndView for the given request, view name and exception.
protected  ModelAndViewgetModelAndView(String viewName, Exception ex)
     Return a ModelAndView for the given view name and exception.
public  intgetOrder()
    
protected  voidlogException(Exception ex, RenderRequest request)
     Log the given exception at warn level, provided that warn logging has been activated through the SimpleMappingExceptionResolver.setWarnLogCategory "warnLogCategory" property.

Calls SimpleMappingExceptionResolver.buildLogMessage in order to determine the concrete message to log.

public  ModelAndViewresolveException(RenderRequest request, RenderResponse response, Object handler, Exception ex)
     Checks whether this resolver is supposed to apply (i.e.
public  voidsetDefaultErrorView(String defaultErrorView)
     Set the name of the default error view.
public  voidsetExceptionAttribute(String exceptionAttribute)
     Set the name of the model attribute as which the exception should be exposed.
public  voidsetExceptionMappings(Properties mappings)
     Set the mappings between exception class names and error view names. The exception class name can be a substring, with no wildcard support at present.
public  voidsetMappedHandlerClasses(Class[] mappedHandlerClasses)
     Specify the set of classes that this exception resolver should apply to. The exception mappings and the default error view will only apply to handlers of the specified type; the specified types may be interfaces and superclasses of handlers as well.

If no handlers and handler classes are set, the exception mappings and the default error view will apply to all handlers.

public  voidsetMappedHandlers(Set mappedHandlers)
     Specify the set of handlers that this exception resolver should map. The exception mappings and the default error view will only apply to the specified handlers.

If no handlers set, both the exception mappings and the default error view will apply to all handlers.

public  voidsetOrder(int order)
    
public  voidsetRenderWhenMinimized(boolean renderWhenMinimized)
     Set if the resolver should render a view when the portlet is in a minimized window.
public  voidsetWarnLogCategory(String loggerName)
     Set the log category for warn logging.
protected  booleanshouldApplyTo(RenderRequest request, Object handler)
     Check whether this resolver is supposed to apply to the given handler.

Field Detail
DEFAULT_EXCEPTION_ATTRIBUTE
final public static String DEFAULT_EXCEPTION_ATTRIBUTE(Code)
The default name of the exception attribute: "exception".



logger
final protected Log logger(Code)
Logger available to subclasses





Method Detail
buildLogMessage
protected String buildLogMessage(Exception ex, RenderRequest request)(Code)
Build a log message for the given exception, occured during processing the given request.
Parameters:
  ex - the exception that got thrown during handler execution
Parameters:
  request - current portlet request (useful for obtaining metadata) the log message to use



determineViewName
protected String determineViewName(Exception ex, RenderRequest request)(Code)
Determine the view name for the given exception, searching the SimpleMappingExceptionResolver.setExceptionMappings "exceptionMappings" , using the SimpleMappingExceptionResolver.setDefaultErrorView "defaultErrorView" as fallback.
Parameters:
  ex - the exception that got thrown during handler execution
Parameters:
  request - current portlet request (useful for obtaining metadata) the resolved view name, or null if none found



doResolveException
protected ModelAndView doResolveException(RenderRequest request, RenderResponse response, Object handler, Exception ex)(Code)
Actually resolve the given exception that got thrown during on handler execution, returning a ModelAndView that represents a specific error page if appropriate.
Parameters:
  request - current portlet request
Parameters:
  response - current portlet response
Parameters:
  handler - the executed handler, or null if none chosen at the time ofthe exception (for example, if multipart resolution failed)
Parameters:
  ex - the exception that got thrown during handler execution a corresponding ModelAndView to forward to, or null for default processing



findMatchingViewName
protected String findMatchingViewName(Properties exceptionMappings, Exception ex)(Code)
Find a matching view name in the given exception mappings
Parameters:
  exceptionMappings - mappings between exception class names and error view names
Parameters:
  ex - the exception that got thrown during handler execution the view name, or null if none found
See Also:   SimpleMappingExceptionResolver.setExceptionMappings



getDepth
protected int getDepth(String exceptionMapping, Exception ex)(Code)
Return the depth to the superclass matching.

0 means ex matches exactly. Returns -1 if there's no match. Otherwise, returns depth. Lowest depth wins.

Follows the same algorithm as org.springframework.transaction.interceptor.RollbackRuleAttribute .




getModelAndView
protected ModelAndView getModelAndView(String viewName, Exception ex, RenderRequest request)(Code)
Return a ModelAndView for the given request, view name and exception. Default implementation delegates to getModelAndView(viewName, ex).
Parameters:
  viewName - the name of the error view
Parameters:
  ex - the exception that got thrown during handler execution
Parameters:
  request - current portlet request (useful for obtaining metadata) the ModelAndView instance
See Also:   SimpleMappingExceptionResolver.getModelAndView(String,Exception)



getModelAndView
protected ModelAndView getModelAndView(String viewName, Exception ex)(Code)
Return a ModelAndView for the given view name and exception. Default implementation adds the specified exception attribute. Can be overridden in subclasses.
Parameters:
  viewName - the name of the error view
Parameters:
  ex - the exception that got thrown during handler execution the ModelAndView instance
See Also:   SimpleMappingExceptionResolver.setExceptionAttribute



getOrder
public int getOrder()(Code)



logException
protected void logException(Exception ex, RenderRequest request)(Code)
Log the given exception at warn level, provided that warn logging has been activated through the SimpleMappingExceptionResolver.setWarnLogCategory "warnLogCategory" property.

Calls SimpleMappingExceptionResolver.buildLogMessage in order to determine the concrete message to log. Always passes the full exception to the logger.
Parameters:
  ex - the exception that got thrown during handler execution
Parameters:
  request - current portlet request (useful for obtaining metadata)
See Also:   SimpleMappingExceptionResolver.setWarnLogCategory
See Also:   SimpleMappingExceptionResolver.buildLogMessage
See Also:   org.apache.commons.logging.Log.warn(ObjectThrowable)




resolveException
public ModelAndView resolveException(RenderRequest request, RenderResponse response, Object handler, Exception ex)(Code)
Checks whether this resolver is supposed to apply (i.e. the handler matches in case of "mappedHandlers" having been specified), then delegates to the SimpleMappingExceptionResolver.doResolveException template method.



setDefaultErrorView
public void setDefaultErrorView(String defaultErrorView)(Code)
Set the name of the default error view. This view will be returned if no specific mapping was found.

Default is none.




setExceptionAttribute
public void setExceptionAttribute(String exceptionAttribute)(Code)
Set the name of the model attribute as which the exception should be exposed. Default is "exception".
See Also:   SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE



setExceptionMappings
public void setExceptionMappings(Properties mappings)(Code)
Set the mappings between exception class names and error view names. The exception class name can be a substring, with no wildcard support at present. A value of "PortletException" would match javax.portet.PortletException and subclasses, for example.

NB: Consider carefully how specific the pattern is, and whether to include package information (which isn't mandatory). For example, "Exception" will match nearly anything, and will probably hide other rules. "java.lang.Exception" would be correct if "Exception" was meant to define a rule for all checked exceptions. With more unusual exception names such as "BaseBusinessException" there's no need to use a FQN.

Follows the same matching algorithm as RuleBasedTransactionAttribute and RollbackRuleAttribute.
Parameters:
  mappings - exception patterns (can also be fully qualified class names)as keys, and error view names as values
See Also:   org.springframework.transaction.interceptor.RuleBasedTransactionAttribute
See Also:   org.springframework.transaction.interceptor.RollbackRuleAttribute




setMappedHandlerClasses
public void setMappedHandlerClasses(Class[] mappedHandlerClasses)(Code)
Specify the set of classes that this exception resolver should apply to. The exception mappings and the default error view will only apply to handlers of the specified type; the specified types may be interfaces and superclasses of handlers as well.

If no handlers and handler classes are set, the exception mappings and the default error view will apply to all handlers. This means that a specified default error view will be used as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be ignored in this case.




setMappedHandlers
public void setMappedHandlers(Set mappedHandlers)(Code)
Specify the set of handlers that this exception resolver should map. The exception mappings and the default error view will only apply to the specified handlers.

If no handlers set, both the exception mappings and the default error view will apply to all handlers. This means that a specified default error view will be used as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be ignored in this case.




setOrder
public void setOrder(int order)(Code)



setRenderWhenMinimized
public void setRenderWhenMinimized(boolean renderWhenMinimized)(Code)
Set if the resolver should render a view when the portlet is in a minimized window. The default is "false".
See Also:   javax.portlet.RenderRequest.getWindowState
See Also:   javax.portlet.WindowState.MINIMIZED



setWarnLogCategory
public void setWarnLogCategory(String loggerName)(Code)
Set the log category for warn logging. The name will be passed to the underlying logger implementation through Commons Logging, getting interpreted as log category according to the logger's configuration.

Default is no warn logging. Specify this setting to activate warn logging into a specific category. Alternatively, override the SimpleMappingExceptionResolver.logException method for custom logging.
See Also:   org.apache.commons.logging.LogFactory.getLog(String)
See Also:   org.apache.log4j.Logger.getLogger(String)
See Also:   java.util.logging.Logger.getLogger(String)




shouldApplyTo
protected boolean shouldApplyTo(RenderRequest request, Object handler)(Code)
Check whether this resolver is supposed to apply to the given handler.

The default implementation checks against the specified mapped handlers and handler classes, if any, and alspo checks the window state (according to the "renderWhenMinimize" property).
Parameters:
  request - current portlet request
Parameters:
  handler - the executed handler, or null if none chosen at thetime of the exception (for example, if multipart resolution failed) whether this resolved should proceed with resolving the exceptionfor the given request and handler
See Also:   SimpleMappingExceptionResolver.setMappedHandlers
See Also:   SimpleMappingExceptionResolver.setMappedHandlerClasses




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.