Example usage for org.springframework.web.context.request WebRequest getLocale

List of usage examples for org.springframework.web.context.request WebRequest getLocale

Introduction

In this page you can find the example usage for org.springframework.web.context.request WebRequest getLocale.

Prototype

Locale getLocale();

Source Link

Document

Return the primary Locale for this request.

Usage

From source file:com.example.todo.api.common.error.RestGlobalExceptionHandler.java

private ApiError createApiError(WebRequest request, String errorCode, Object... args) {
    return new ApiError(errorCode, messageSource.getMessage(errorCode, args, request.getLocale()));
}

From source file:com.example.todo.api.common.error.RestGlobalExceptionHandler.java

private ApiError createApiError(WebRequest request, DefaultMessageSourceResolvable messageSourceResolvable,
        String target) {//from   w  w w  . java 2 s .  c  o m
    return new ApiError(messageSourceResolvable.getCode(),
            messageSource.getMessage(messageSourceResolvable, request.getLocale()), target);
}