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

📄 requestbasepathinterceptor.java

📁 天乙虚拟社区8.05版本。只支持Mysql
💻 JAVA
字号:
package com.laoer.bbscs.web.interceptor;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.laoer.bbscs.comm.*;

public class RequestBasePathInterceptor extends AbstractInterceptor {

	/**
	 *
	 */
	private static final long serialVersionUID = 369409256340402236L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		ActionContext ac = invocation.getInvocationContext();
		Object action = invocation.getAction();

		if (action instanceof RequestBasePathAware) {
			HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST);
			StringBuffer sb = new StringBuffer();
			sb.append(BBSCSUtil.getWebRealPath(request));
			sb.append(request.getContextPath());
			sb.append("/");
			((RequestBasePathAware) action).setBasePath(sb.toString());
		}

		return invocation.invoke();
	}

}

⌨️ 快捷键说明

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