| | |
| | |
|
| | | public ResultBean() {
|
| | | }
|
| | |
|
| | | public static ResultBean success(){
|
| | | return new ResultBean("操作成功",SUCCESS);
|
| | | }
|
| | | public static ResultBean fail(){
|
| | | return new ResultBean("操作失败",FAIL);
|
| | | }
|
| | | public ResultBean(Throwable e) {
|
| | | this.message = e.toString();
|
| | | this.code = FAIL;
|
| | |
| | | * @version $Id: StringToDateConverter.java, v 0.1 2015年9月24日 下午7:19:41 byshome Exp $ |
| | | */ |
| | | public class StringToDateConverter implements Converter<String, Date> { |
| | | Logger log = Logger.getLogger(StringToDateConverter.class); |
| | | private static Logger log = Logger.getLogger(StringToDateConverter.class); |
| | | private static final String dateFormat = "yyyy-MM-dd HH:mm:ss"; |
| | | // private static final String shortDateFormat = "yyyy-MM-dd"; |
| | | private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); |
| | |
| | | mapper.writeValue(response.getWriter(), ErrorResponse.of("Token has expired", ErrorCode.JWT_TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED)); |
| | | } else if (e instanceof AuthMethodNotSupportedException) { |
| | | mapper.writeValue(response.getWriter(), ErrorResponse.of(e.getMessage(), ErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED)); |
| | | } else { |
| | | mapper.writeValue(response.getWriter(), ErrorResponse.of(e.getMessage(), ErrorCode.AUTHENTICATION, HttpStatus.OK)); |
| | | } |
| | | // mapper.writeValue(response.getWriter(), ErrorResponse.of("Authentication failed", ErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED)); |
| | | mapper.writeValue(response.getWriter(), ErrorResponse.of(e.getMessage(), ErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED)); |
| | | } |
| | | } |