|
|
|
@ -1,8 +1,7 @@ |
|
|
|
|
package com.xxl.job.admin.controller.resolver; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
import com.xxl.job.admin.core.model.ReturnT; |
|
|
|
|
import com.xxl.job.core.util.JacksonUtil; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
@ -10,8 +9,8 @@ import org.springframework.web.method.HandlerMethod; |
|
|
|
|
import org.springframework.web.servlet.HandlerExceptionResolver; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
import com.xxl.job.admin.core.model.ReturnT; |
|
|
|
|
import com.xxl.job.core.util.JacksonUtil; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* common exception resolver |
|
|
|
@ -29,6 +28,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver { |
|
|
|
|
HandlerMethod method = (HandlerMethod)handler; |
|
|
|
|
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class); |
|
|
|
|
if (responseBody != null) { |
|
|
|
|
response.setContentType("application/json;charset=UTF-8"); |
|
|
|
|
mv.addObject("result", JacksonUtil.writeValueAsString(new ReturnT<String>(500, ex.toString().replaceAll("\n", "<br/>")))); |
|
|
|
|
mv.setViewName("/common/common.result"); |
|
|
|
|
} else { |
|
|
|
|