⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myinterceptor.java

📁 Struts+Spring开发
💻 JAVA
字号:
package org.ssi.interceptor;

import java.util.Map;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.interceptor.PreResultListener;

public class MyInterceptor implements Interceptor {
	private static Logger logger = Logger.getLogger(MyInterceptor.class);

	public void destroy() {
		// TODO Auto-generated method stub

	}

	public void init() {
		// TODO Auto-generated method stub

	}

	public String intercept(ActionInvocation invocation) throws Exception {

		invocation.addPreResultListener(new PreResultListener() {

			public void beforeResult(ActionInvocation invocation,
					String resultCode) {
				Map resultsMap = invocation.getProxy().getConfig().getResults();
				ResultConfig finalResultConfig = (ResultConfig) resultsMap
						.get(resultCode);
				logger.info("***************MyInterceptor:"
						+ finalResultConfig.getName());
				// do something interesting with the 'to-be' executed result

			}

		});

		return invocation.invoke();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -