Example usage for org.springframework.http.converter HttpMessageNotReadableException getLocalizedMessage

List of usage examples for org.springframework.http.converter HttpMessageNotReadableException getLocalizedMessage

Introduction

In this page you can find the example usage for org.springframework.http.converter HttpMessageNotReadableException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:cn.org.once.cstack.config.RestHandlerException.java

@Override
protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex,
        HttpHeaders headers, HttpStatus status, WebRequest request) {
    ex.printStackTrace();/*from   w ww  .  ja  v a2s . c om*/
    headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    return handleExceptionInternal(ex, new HttpErrorServer(ex.getLocalizedMessage()), headers,
            HttpStatus.BAD_REQUEST, request);
}