Package com.opensymphony.xwork.interceptor

Source Code of com.opensymphony.xwork.interceptor.ExceptionInterceptor

package com.opensymphony.xwork.interceptor;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.ActionSupport;

public class ExceptionInterceptor implements Interceptor {

    protected final Log log = LogFactory.getLog(this.getClass());
   
    public void destroy() {}
    public void init() {}

    public String intercept(ActionInvocation actionInvocation) throws Exception {
        ActionSupport action = (ActionSupport) actionInvocation.getAction();
        try {
            return actionInvocation.invoke();
        } catch (Exception e) {
            action.addActionError("Error: " + e.getMessage());
            log.error(e.getMessage(), e);
            return Action.ERROR;
        }
    }
}
TOP

Related Classes of com.opensymphony.xwork.interceptor.ExceptionInterceptor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.