Use getMessageSource internally in RequestContext

This commit is contained in:
Andre Blanke
2024-05-30 13:48:17 +02:00
committed by Juergen Hoeller
parent 9ceaf21d24
commit a582e48dd0

View File

@@ -661,7 +661,7 @@ public class RequestContext {
* @return the message
*/
public String getMessage(String code, @Nullable Object[] args, String defaultMessage, boolean htmlEscape) {
String msg = this.webApplicationContext.getMessage(code, args, defaultMessage, getLocale());
String msg = getMessageSource().getMessage(code, args, defaultMessage, getLocale());
if (msg == null) {
return "";
}
@@ -709,7 +709,7 @@ public class RequestContext {
* @throws org.springframework.context.NoSuchMessageException if not found
*/
public String getMessage(String code, @Nullable Object[] args, boolean htmlEscape) throws NoSuchMessageException {
String msg = this.webApplicationContext.getMessage(code, args, getLocale());
String msg = getMessageSource().getMessage(code, args, getLocale());
return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg);
}
@@ -731,7 +731,7 @@ public class RequestContext {
* @throws org.springframework.context.NoSuchMessageException if not found
*/
public String getMessage(MessageSourceResolvable resolvable, boolean htmlEscape) throws NoSuchMessageException {
String msg = this.webApplicationContext.getMessage(resolvable, getLocale());
String msg = getMessageSource().getMessage(resolvable, getLocale());
return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg);
}