Search in sources :

Example 21 with ResultInfo

use of lee.study.down.model.ResultInfo in project proxyee-down by monkeyWie.

the class RestExceptionHandler method resolveException.

@Override
public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
    LOGGER.error("rest error:", e);
    ModelAndView modelAndView = new ModelAndView();
    try {
        ResultInfo resultInfo = new ResultInfo().setStatus(ResultStatus.ERROR.getCode()).setMsg(ResultInfo.MSG_ERROR);
        Map<String, Object> attr = JSON.parseObject(JSON.toJSONString(resultInfo), Map.class);
        MappingJackson2JsonView view = new MappingJackson2JsonView();
        view.setAttributesMap(attr);
        modelAndView.setView(view);
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) ResultInfo(lee.study.down.model.ResultInfo) MappingJackson2JsonView(org.springframework.web.servlet.view.json.MappingJackson2JsonView)

Aggregations

ResultInfo (lee.study.down.model.ResultInfo)21 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)18 TaskInfo (lee.study.down.model.TaskInfo)8 AbstractHttpDownBootstrap (lee.study.down.boot.AbstractHttpDownBootstrap)7 HttpDownInfo (lee.study.down.model.HttpDownInfo)6 TimeoutException (java.util.concurrent.TimeoutException)5 BootstrapException (lee.study.down.exception.BootstrapException)5 File (java.io.File)4 IOException (java.io.IOException)4 MalformedURLException (java.net.MalformedURLException)4 LinkedHashMap (java.util.LinkedHashMap)4 HttpDownCallback (lee.study.down.dispatch.HttpDownCallback)4 ConfigInfo (lee.study.down.model.ConfigInfo)4 HttpRequestInfo (lee.study.down.model.HttpRequestInfo)4 NewTaskForm (lee.study.down.mvc.form.NewTaskForm)4 Desktop (java.awt.Desktop)3 Files (java.nio.file.Files)3 Paths (java.nio.file.Paths)3 Arrays (java.util.Arrays)3 HashMap (java.util.HashMap)3