OWL ITS + 탐지시스템(인터넷 진흥원)
src/main/java/kr/wisestone/owl/web/resolver/OwlResponseEntityExceptionHandler.java
@@ -3,6 +3,8 @@
import kr.wisestone.owl.common.MessageAccessor;
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.constant.MsgConstants;
import kr.wisestone.owl.exception.ApiAuthException;
import kr.wisestone.owl.exception.ApiParameterException;
import kr.wisestone.owl.exception.OwlRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +36,22 @@
        super();
    }
    @ExceptionHandler({ApiParameterException.class })
    public ResponseEntity<Object> handleBadRequest(final ApiParameterException ex, final WebRequest request) {
        Map<String, Object> resJsonData = new HashMap<String, Object>();
        resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(ex, Constants.RES_KEY_MSG_FAIL));
        return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.BAD_REQUEST, request);
    }
    @ExceptionHandler({ApiAuthException.class })
    public ResponseEntity<Object> handleBadRequest(final ApiAuthException ex, final WebRequest request) {
        Map<String, Object> resJsonData = new HashMap<String, Object>();
        resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(ex, Constants.RES_KEY_MSG_FAIL));
        return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.UNAUTHORIZED, request);
    }
    @ExceptionHandler({OwlRuntimeException.class })
    public ResponseEntity<Object> handleBadRequest(final OwlRuntimeException ex, final WebRequest request) {
        Map<String, Object> resJsonData = new HashMap<String, Object>();
@@ -48,7 +66,7 @@
        Map<String, Object> resJsonData = new HashMap<String, Object>();
        resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(MsgConstants.NOT_READABLE_JSON_DATA, Constants.RES_KEY_MSG_FAIL));
        return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.OK, request);
        return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.REQUEST_TIMEOUT, request);
    }
    @ExceptionHandler({ Exception.class })
@@ -56,7 +74,7 @@
        Map<String, Object> resJsonData = new HashMap<String, Object>();
        resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(MsgConstants.NOT_READABLE_JSON_DATA, Constants.RES_KEY_MSG_FAIL));
        return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.OK, request);
        return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.BAD_REQUEST, request);
    }
    @Override
@@ -67,7 +85,7 @@
        resJsonData.put(Constants.RES_KEY_MESSAGE,
                this.messageAccessor.getResMessage(MsgConstants.NOT_READABLE_JSON_DATA, Constants.RES_KEY_MSG_FAIL));
        return this.handleExceptionInternal(ex, resJsonData, headers, HttpStatus.OK, request);
        return this.handleExceptionInternal(ex, resJsonData, headers, HttpStatus.BAD_REQUEST, request);
    }
    @Override
@@ -75,7 +93,7 @@
            final MethodArgumentNotValidException ex, final HttpHeaders headers,
            final HttpStatus status, final WebRequest request) {
        final String bodyOfResponse = "This should be application specific4";
        return this.handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.OK, request);
        return this.handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request);
    }
    @Override