Struts自定义拦截器&拦截器工作原理

0.拦截器的调用原理:

  拦截器是一个继承了序列化接口的普通接口。其工作原理是讲需要被拦截的对象作为参数传到intercept()方法内,在方法内部对此对象进行处理之后再执行原方法。intercept(ActionInvocation invocation)是拦截处理的方法。

Interceptor .java
public interface Interceptor extends Serializable {

    /**
* Called to let an interceptor clean up any resources it has allocated.
*/
void destroy(); /**
* Called after an interceptor is created, but before any requests are processed using
* {@link #intercept(com.opensymphony.xwork2.ActionInvocation) intercept} , giving
* the Interceptor a chance to initialize any needed resources.
*/
void init(); /**
* Allows the Interceptor to do some processing on the request before and/or after the rest of the processing of the
* request by the {@link ActionInvocation} or to short-circuit the processing and just return a String return code.
*
* @param invocation the action invocation
* @return the return code, either returned from {@link ActionInvocation#invoke()}, or from the interceptor itself.
* @throws Exception any system-level error, as defined in {@link com.opensymphony.xwork2.Action#execute()}.
*/
String intercept(ActionInvocation invocation) throws Exception; }

1.自定义拦截器步骤

I. 定义一个拦截器的类

> 可以实现 Interceptor 接口
    > 继承 AbstractInterceptor 抽象类

 

1.拦截器

 package Action;

 import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor; public class PrivelegeInterceptor implements Interceptor { @Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void init() {
// TODO Auto-generated method stub
//初始化方法,获得数据库信息。调用服务
} @Override
public String intercept(ActionInvocation arg0) throws Exception { //如果用户登录了就会有user属性(Session里面存一个session属性)
Object user = arg0.getInvocationContext().getSession().get("user");
// 上面可能是系统权限的管理
String result="";
System.out.println(user);
if(user!=null){
// 当满足条件时,让其执行,相当于是放行
arg0.invoke();
}else {
result = "logon";
ActionContext.getContext().put("msg", "您没有权限管理");
}
System.out.println(result);
return result;
}
}

2.被拦截的Action

 package Action;

 import com.opensymphony.xwork2.ActionContext;

 public class UserAction {

     public String addUI(){
ActionContext.getContext().put("msg", "成功执行了addUI操作");
System.out.println("执行addui操作");
return "success";
} public String update(){
ActionContext.getContext().put("msg", "成功执行了update操作");
System.out.println("执行update操作");
return "success";
}
}

3.JSP页面(主页面,也就是开始时要访问Action的页面)

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%-- <%
session.setAttribute("user", "uuuu");
%> --%>
Success
${msg }
<a href="/struts2interceptor/user_addUI.action">addui</a>
<a href="/struts2interceptor/user_update.action">update</a>
</body>
</html>

msg.jsp   也就是被拦截到没有权限时要去的页面

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
${msg }
</body>
</html>

II. 在 struts.xml 文件配置.  

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"> <struts>
<!--
package的名字必须唯一!只能拦截.action请求
默认值:class:com.opensymphony.xwork2.ActionSupport
method:execute
result的name属性:success 方法中返回success即可跳转到结果对应的页面 --> <!-- 第一个package命名空间 -->
<package name="intercept" namespace="/" extends="struts-default"> <!-- 拦截器 -->
<interceptors>
<!-- 定义刚才的拦截器 -->
<interceptor name="permission" class="Action.PrivelegeInterceptor"></interceptor>
<!-- 定义拦截器栈 -->
<interceptor-stack name="permissionStack">
<!-- 拦截器栈里面可以引用另外一个拦截器,也可以引用另外一个拦截器栈 -->
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="permission"></interceptor-ref>
</interceptor-stack>
</interceptors> <action name="user_*" class="Action.UserAction" method="{1}">
<result>/index.jsp</result>
<result name="logon">/msg.jsp</result>
<!-- 使用拦截器栈 -->
<interceptor-ref name="permissionStack"></interceptor-ref>
</action>
</package> </struts>

第二种使用拦截器的方式是:(在前面定义一下拦截器,然后在Action中使用新定义的拦截器与默认的拦截器)

    <interceptors>

         <interceptor name="hello" class="com.atguigu.struts2.interceptors.MyInterceptor"></interceptor>

     </interceptors>

     <action name="testToken" class="com.atguigu.struts2.token.app.TokenAction">
<interceptor-ref name="hello"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
<result>/success.jsp</result>
<result name="invalid.token">/token-error.jsp</result>
</action>

 III. 注意: 在自定义的拦截器中可以选择不调用 ActionInvocation 的 invoke() 方法. 那么后续的拦截器和 Action 方法将不会被调用.Struts 会渲染自定义拦截器 intercept 方法返回值对应的 result

这种经常用于权限管理,例如上面的拦截器,没有权限时,返回的是logon,自动渲染返回值为设置的值,然后根据返回值在Action配置中跳转到响应的页面。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj0AAABvCAIAAACIKuaDAAAXH0lEQVR4nO2dvXKzyBKGuR5dAolvQvmXqLgHBadQ4pyE8iZOnVCOThWpCpejU7XhkhD4c7LBkm7eJwDB/HQPP+JXfp9yYGlgGDFDv3RPw3gEAAAA7Adv7QYAAAAAA4BuAQAA2BPQLQAAAHsCugUAAGBPbFK38uQpDE9ZuXY7luMa0MGj14IopYNH53TtBrEUdPTpy/p6ysanSeiF1V+y9klYuFO+Ijp4dIzmPcoDMO2JWv3Sy4MwDPIlK+n+ySkdvAFn49Wng0eHYNSxRrGSbuXJU5h8ukp/lm69+nTw6et2Tb4WazdI5xrQOSUq6BjUH69K6QyNz5MN6Jb7d1VfsteqSEFH+dJdRrfORgPS2cfbxk/UcpdemoReYmvL8rrV8ZMLOrLnoaCjJ3el0GUznd6BulV++Jf3CeyJW7d+Hq9+fR1eg7qbt0VBR4+OEZ2D+t5KHX8zNH4ruiX+rurajgb+3pQO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O4Keho72QMy9Eu9GRkQGT0tFCFzOZlDvy8raZTzh8kNm9RUTuAK6jC8vsJDzt4ahQb5IVLhdayASjtXD5hIOsM5w9tW41RVWqRbduGfNbd8PZXHVyS7K5kjlu3Ivmn6/INMqt9S/ozFXiEDa2iKlQ94HsCGerfLI82/NSfMOUY1UtUSsUJ7fU48rJICzj8gnTd/dtO0xKVwsdzGBS9ppPWKM/h6E+WW0kqHQMMj2FRkytMTNe5DNeZqc+uTpGC5XvhRHPVKjt2GPetQPnXuLZIJo4TlilXdySCfMo7qNbVEuXFV0ch57nZjoTSnSOTYSzaaayGmFjFC61DicdyF3kqND4aUbahfDRzBjkfKAz15I2qdKnL0sItWqFea8Bz02PfH5LzMiASdmiSdn381uPxa4f2n1Ipn0aCWyW4uNl6MT+LoBJkYBuTQYG2dbAA8g/A3dGxo6BSZGAbk0GBtnWcKQkALB9YFIkoFsAAAD2BHQLAADAnoBuAQAA2BPQLQAAAHsCugUAAGBPTKhbi2SjYr1tAAD42UynW66XMQ+qx/lEN3QLAAB+NgN165GWx55waVQAAABLMUS3Hm557Dvf7QgAAGB5+urW4OWxqVkl01qFjIhdsrpj8Wl5vW1zX+VY0kLXxu96yJfEAADAQ9JLt8Ysj11mJ/0N/E/iR6Myt78lrbfNr0vdsRR3vcfItcsAAAAsT6du3bk8do36oi15yeqqtoG65VwnrXOpgqbaEWtFAwAAWJ77/S0p/V2LBDqWvTEZo1viutS9dAv+FgAA7Ie757f4jAwtWEe6YMhLVhPR4v7WHWtFAwAAWJ578wmF5bHtxaGVj/KS1U2pnXnRNKLX/Fa/JU2RTwgAALvjzue3xOWxtUWp4+wzizVHR16ymoTFpx3rbZulslBpH/H8FgAA7JD/A9rAEoYzrVKtAAAAAElFTkSuQmCC" alt="" />

IV.测试

1.没权限的测试,即session中不存在user

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYsAAABMCAIAAAATGAxkAAAMe0lEQVR4nO2d21IaWx6HeSOeiAfJVPYUu2Zuu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EwgqyOSRB32+HyClryBAJPqU6U9gtwAGA2poQhvCKcvNwdJi7FBFf3aQjECTah8h0TGIY8bh/UnNoZSfR6Px6eSTu51um83kWnIUyLqEj8FAAyH2FB9J5khiyjGsQis2MkpXQYyUhDCCa3nEqYUsyTVxdTLZbnKo2K4fhHqpIUnCkMBcAuIDNXbkvF6PT6Vcwu1gOodEQVMrD9MRXA5Hc5iulZ+9jMxkTegEf2yjqGsYkRZRMcaSgwMBcBoCAzFze8ut26iDuq7UHrY4nRD226xx29k0xtdVCtsIOQNqOIghzsjxxv9dDbEUADcAtJ9KHMGUtLpG0rTWBUN8FGbXj0bUjGHyelNhDm9Ev1NInHr5v64k1UeUYWD2IkPuXwqDAXAhLAzFDPNKHOIN6LkayaqoL4z7SiG0gJer9dL7WZTimL0qHfa6CCnLIE/pEIRuxerPABuAQcxVLfblW0kETCf/fG7RHxsYbG6oqtQff0P+fWt+76izHiKbo9rQfyZHvfKWQzFjw9iKAAmxLjuKacDDdoZsg/sHBrKjOaY3OaemPAA8YyXYn+TXtUkvrJF0nloCYBxIjFU3xD6NOQtwMxEoT48ulgkHnK4ylN9xl0PbD3kXRGizrExVJcIlQSFLGHEQ39S6LAQAGAwhIYyIhgyUDAt1XMFaS35Vo18WTjAKk/Shm440c2bXp/Pax6jfCrZ07eMfviDpl6tzA0AGAmBoQj1CB1C37zdv2dK+GmXvjst8ZSNoQS3VNHrSI+pURtNEFvn3oAmXnY6NpTFGcFQAIwXm30o8UJMEMpQn+pLviTCluU1RK6XRKswshWL7/2KbmlnOsbfLDrgKs96hLDOA2As3J9fXyHWlvLv2njYbadutyv9fs4Ad5cCAO6E+2MoAMDDA4YCALgXGAoA4F5gKACAe4GhAADuBYYCALgXGAoA4F5gKACAe4GhAADuBYYCALgXGAoA4F7+DzzQYHo0LAfCAAAAAElFTkSuQmCC" alt="" />

2.有权限的测试,即session中存在user

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAiAAAADWCAIAAABnv65mAAAWr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vJeicaN+bbeuKroyvG7RLlyZLtEWdDoxO0Yx19z/MTJHiD86Ml7VNLH90e8GvieEaSxrxYFxBV8WmhfgJtRyBTmRZ0YTMIr/OZdS+RGD1kAKqBHxIsJrj8sqGOMxIkxXWaNK5g8Kho/zLupgWnkYIKvLGn7mkQN80LwXGBiXzwN+fBaf9x2eLRCMF0SjRxMKLnQYiKEYLokQjB5XAgmQggmFArlOSGYUCiU54RgQqFQnhOCCYVCeU4IJhQK5TkhmFAolOf0fzMuOHaXnIV4AAAAAElFTkSuQmCC" alt="" />

Struts2 拦截器 和 过滤器 的区别:

①、过滤器依赖于 Servlet 容器,而拦截器不依赖于 Servlet 容器。

②、Struts2 拦截器只能对 Action 请求起作用,而过滤器则可以对几乎所 有请求起作用。

③、拦截器可以访问 Action 上下文(ActionContext)、值栈里的对象 (ValueStack),而过滤器不能.

④、在 Action 的生命周期中,拦截器可以多次调用,而过滤器只能在容器 初始化时被调用一次。

上一篇:HTML、canvas、video灰度


下一篇:WPF中viewmodel层怎样得到view层的TabControl控件对象?