Filter里明明返回了JsonView,为什么客户端看到请求的状态是canceled啊,response的结果什么都没有。
public class ApiTokenFilter implements ActionFilter {
private static final Log log = Logs.get();
public View match(ActionContext context) {
try {
String appid = Strings.sNull(context.getRequest().getHeader("appid"));
String token = Strings.sNull(context.getRequest().getHeader("token"));
log.debug("appid:::" + appid);
log.debug("token:::" + token);
context.setRequest(context.getIoc().get(TokenUtil.class).verifyToken(context.getRequest(), appid, token));
return null;
}
catch (Exception e) {
e.printStackTrace();
return new UTF8JsonView(JsonFormat.compact()).setData(Result.error(-2, "token失效"));
}
}
}