§ 过滤器说明
平台在收到外部请求之后,会对请求做一系列处理,最终将请求转到对应的服务类中。同时在调用服务前、后会经过一系列过滤器
常用的过滤器有
- 消息解析过滤器
- 必输字段过滤器
- 权限过滤器
- 返回码处理过滤器
代码
package service.common.filter;
import java.util.Map;
import service.common.bean.JsonRequest;
import service.common.bean.JsonResponse;
import both.common.util.LoggerUtil;
import cn.com.bankit.phoenix.communication.http.HttpMessage;
import cn.com.bankit.phoenix.trade.filter.Event;
import cn.com.bankit.phoenix.trade.filter.Filter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
/**
* 消息解析过滤器
*
* @author 江成
*
*/
public class MessageParser extends Filter {
/**
* 构造函数
*/
public MessageParser() {
super();
}
/**
* before
*/
public void before(Event e) throws Exception {
}
/**
* after
*/
public void after(Event e) throws Exception {
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
配置过滤器信息
<package name="filter-base" abstract="true">
<!-- 数据解析 filter -->
<filter name="MessageParseFilter" class="service.common.filter.MessageParser" scope="singleton">
</filter>
</package>
1
2
3
4
5
2
3
4
5
服务引用 在服务接口的配置文件中添加过滤器
extends="filter-base.xml,filter-verify.xml"
1