From 6110581df2fbd235c93381586fbccea05ba3295a Mon Sep 17 00:00:00 2001 From: jiangjiazhi Date: Sat, 30 Apr 2016 10:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=80=A7=E8=83=BD=E6=8B=A6?= =?UTF-8?q?=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/controller/RestController.java | 15 +++++++++++++++ .../spring/applicationContext_biz_patient.xml | 18 +++++++++++++++++- platform-operate-api/src/main/webapp/WEB-INF/web.xml | 12 ++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java index 8f6069a..c865bfd 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java @@ -2,11 +2,14 @@ package com.lyms.platform.operate.web.controller; import java.util.List; +import com.lyms.platform.common.constants.ErrorCodeConstants; import com.lyms.platform.common.core.resolve.MessageResolver; import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.common.utils.ExceptionUtils; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; +import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; import org.springframework.web.bind.MethodArgumentNotValidException; @@ -29,6 +32,18 @@ public class RestController { return createValidationResponse(e.getBindingResult()); } + @ExceptionHandler(HttpMessageNotReadableException.class) + @ResponseBody + @ResponseStatus(HttpStatus.BAD_REQUEST) + public BaseResponse handException(HttpMessageNotReadableException e){ + ExceptionUtils.catchException(e,e.getMessage()); + BaseResponse error = new BaseResponse(); + error.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); + error.setErrormsg("参数错误"); + return error; + } + + @ExceptionHandler(BindException.class) @ResponseStatus(HttpStatus.OK) @ResponseBody diff --git a/platform-operate-api/src/main/resources/spring/applicationContext_biz_patient.xml b/platform-operate-api/src/main/resources/spring/applicationContext_biz_patient.xml index 27055bb..3b84ba0 100644 --- a/platform-operate-api/src/main/resources/spring/applicationContext_biz_patient.xml +++ b/platform-operate-api/src/main/resources/spring/applicationContext_biz_patient.xml @@ -39,7 +39,7 @@ + class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="autoProxyCreator"> @@ -47,6 +47,22 @@ + + + + + + mysqlDalInterceptor + + + + + + + + diff --git a/platform-operate-api/src/main/webapp/WEB-INF/web.xml b/platform-operate-api/src/main/webapp/WEB-INF/web.xml index 6b6466e..16661fe 100644 --- a/platform-operate-api/src/main/webapp/WEB-INF/web.xml +++ b/platform-operate-api/src/main/webapp/WEB-INF/web.xml @@ -87,6 +87,18 @@ / + perfFilter + com.lyms.platform.common.perf.SimpleHttpPerfFilter + + fixName + .jsp,.vm,.js,.css + + + + perfFilter + /* + + HttpMethodFilter org.springframework.web.filter.HttpPutFormContentFilter -- 1.8.3.1