struts2 下载远程文件时,下载的是方法.action,大牛们帮忙看看。
struts2下载远程文件时,下载的是方法.action,配置如下:<paramname="contentType">application/octet-stream</...
struts2 下载远程文件时,下载的是方法.action,
配置如下:
<param name="contentType">application/octet-stream</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment;filename="${videoname}"</param>
<param name="bufferSize">4096</param> 展开
配置如下:
<param name="contentType">application/octet-stream</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment;filename="${videoname}"</param>
<param name="bufferSize">4096</param> 展开
1个回答
展开全部
首先,struts2进行权限验证是用拦截器做的
一个简单的登录拦截器示例如下:
package com.zdf.interceptor;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.zdf.entity.Admin;
@SuppressWarnings("serial")
public class LoginInterceptor extends AbstractInterceptor{
@Override
public String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
Admin admin = (Admin)invocation.getInvocationContext().getSession().get("ADMIN");
if(admin!=null){
return invocation.invoke();
}else{
return Action.LOGIN;
}
}
}
一个简单的登录拦截器示例如下:
package com.zdf.interceptor;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.zdf.entity.Admin;
@SuppressWarnings("serial")
public class LoginInterceptor extends AbstractInterceptor{
@Override
public String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
Admin admin = (Admin)invocation.getInvocationContext().getSession().get("ADMIN");
if(admin!=null){
return invocation.invoke();
}else{
return Action.LOGIN;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询