ActionInterceptor接口的作用

作者在 2017-06-30 10:36:56 发布以下内容

ActionInterceptor接口的作用

* 请求之前拦截器
     */
    @Override
    public ActionResult preExecute(BeatContext beat) {
        try {
            String customerCode = (String) beat.getRequest().getParameter(Constants.REQUEST_PARAMETER_CUSTOMERCODE);
            //获取请求IP
            String ip = IpUtil.getFirstIpAddr(beat);
            if (StringUtils.isBlank(customerCode)) {
                logger.error("customerCode为空");
                CommonResultInfo result = new CommonResultInfo();
                result.setSuccess(false);
                result.setMessage(ConstantAPIEnum.COMMON_CUSTOMERCODE_BLANK_ERROR.getMessage());
                result.setCode(ConstantAPIEnum.COMMON_CUSTOMERCODE_BLANK_ERROR.getCode());
                //直接返回失败
                return new JsonBeanResult(result);
            }

默认分类 | 阅读 1785 次
文章评论,共0条
游客请输入验证码
浏览1785次
文章分类
文章归档
最新评论