at WARN level.
<xwork>
<include file="webwork-default.xml"/>
<package name="something" extends="webwork-default">
<interceptors>
<interceptor-stack name="exceptionmapping-stack">
<interceptor-ref name="exception">
<param name="logEnabled">true</param>
<param name="logCategory">com.mycompany.app.unhandled</param>
<param name="logLevel">WARN</param>
</interceptor-ref>
<interceptor-ref name="i18n"/>
<interceptor-ref name="static-params"/>
<interceptor-ref name="params"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="exceptionmapping-stack"/>
<global-results>
<result name="unhandledException">/unhandled-exception.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="unhandledException"/>
</global-exception-mappings>
<action name="exceptionDemo" class="com.opensymphony.webwork.showcase.exceptionmapping.ExceptionMappingAction">
<exception-mapping exception="com.opensymphony.webwork.showcase.exceptionmapping.ExceptionMappingException"
result="damm"/>
<result name="input">index.jsp</result>
<result name="success">success.jsp</result>
<result name="damm">damm.jsp</result>
</action>
</package>
</xwork>
- Author:
- Matthew E. Porter (matthew dot porter at metissian dot com), Claus Ibsen
- See Also:
- Serialized Form
Method Summary |
void |
destroy()
Called to let an interceptor clean up any resources it has allocated. |
protected void |
doLog(org.apache.commons.logging.Log logger,
java.lang.Exception e)
Performs the actual logging. |
int |
getDepth(java.lang.String exceptionMapping,
java.lang.Throwable t)
Return the depth to the superclass matching. |
java.lang.String |
getLogCategory()
|
java.lang.String |
getLogLevel()
|
protected void |
handleLogging(java.lang.Exception e)
Handles the logging of the exception. |
void |
init()
Called after an interceptor is created, but before any requests are processed using
intercept , giving
the Interceptor a chance to initialize any needed resources. |
java.lang.String |
intercept(ActionInvocation invocation)
Allows the Interceptor to do some processing on the request before and/or after the rest of the processing of the
request by the ActionInvocation or to short-circuit the processing and just return a String return code. |
boolean |
isLogEnabled()
|
protected void |
publishException(ActionInvocation invocation,
ExceptionHolder exceptionHolder)
Default implementation to handle ExceptionHolder publishing. |
void |
setLogCategory(java.lang.String logCatgory)
|
void |
setLogEnabled(boolean logEnabled)
|
void |
setLogLevel(java.lang.String logLevel)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static final org.apache.commons.logging.Log log
categoryLogger
protected org.apache.commons.logging.Log categoryLogger
logEnabled
protected boolean logEnabled
logCategory
protected java.lang.String logCategory
logLevel
protected java.lang.String logLevel
ExceptionMappingInterceptor
public ExceptionMappingInterceptor()
isLogEnabled
public boolean isLogEnabled()
setLogEnabled
public void setLogEnabled(boolean logEnabled)
getLogCategory
public java.lang.String getLogCategory()
setLogCategory
public void setLogCategory(java.lang.String logCatgory)
getLogLevel
public java.lang.String getLogLevel()
setLogLevel
public void setLogLevel(java.lang.String logLevel)
destroy
public void destroy()
- Description copied from interface:
Interceptor
- Called to let an interceptor clean up any resources it has allocated.
- Specified by:
destroy
in interface Interceptor
init
public void init()
- Description copied from interface:
Interceptor
- Called after an interceptor is created, but before any requests are processed using
intercept
, giving
the Interceptor a chance to initialize any needed resources.
- Specified by:
init
in interface Interceptor
intercept
public java.lang.String intercept(ActionInvocation invocation)
throws java.lang.Exception
- Description copied from interface:
Interceptor
- Allows the Interceptor to do some processing on the request before and/or after the rest of the processing of the
request by the
ActionInvocation
or to short-circuit the processing and just return a String return code.
- Specified by:
intercept
in interface Interceptor
- Returns:
- the return code, either returned from
ActionInvocation.invoke()
, or from the interceptor itself.
- Throws:
java.lang.Exception
- any system-level error, as defined in Action.execute()
.
handleLogging
protected void handleLogging(java.lang.Exception e)
- Handles the logging of the exception.
- Parameters:
e
- the exception to log.
doLog
protected void doLog(org.apache.commons.logging.Log logger,
java.lang.Exception e)
- Performs the actual logging.
- Parameters:
logger
- the provided logger to use.e
- the exception to log.
getDepth
public int getDepth(java.lang.String exceptionMapping,
java.lang.Throwable t)
- 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.
- Parameters:
exceptionMapping
- the mapping classnamet
- the cause
- Returns:
- the depth, if not found -1 is returned.
publishException
protected void publishException(ActionInvocation invocation,
ExceptionHolder exceptionHolder)
- Default implementation to handle ExceptionHolder publishing. Pushes given ExceptionHolder on the stack.
Subclasses may override this to customize publishing.
- Parameters:
invocation
- The invocation to publish Exception for.exceptionHolder
- The exceptionHolder wrapping the Exception to publish.