/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code, @Nullable List<?> args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), getLocale()); }
/** * Retrieve the given MessageSourceResolvable in the current theme. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param resolvable the MessageSourceResolvable * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(resolvable, getLocale()); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, @Nullable List<?> args, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), defaultMessage, getLocale()); return (msg != null ? msg : ""); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code, @Nullable Object[] args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, args, getLocale()); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, null, getLocale()); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, @Nullable Object[] args, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, args, defaultMessage, getLocale()); return (msg != null ? msg : ""); }
/** * Retrieve the message for the given code. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param htmlEscape if the message should be HTML-escaped * @return the message * @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()); return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, null, defaultMessage, getLocale()); return (msg != null ? msg : ""); }
/** * Retrieve the message for the given code. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @param htmlEscape if the message should be HTML-escaped * @return the message */ public String getMessage(String code, @Nullable Object[] args, String defaultMessage, boolean htmlEscape) { String msg = this.webApplicationContext.getMessage(code, args, defaultMessage, getLocale()); if (msg == null) { return ""; } return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); }
/** * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance). * @param resolvable the MessageSourceResolvable * @param htmlEscape if the message should be HTML-escaped * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(MessageSourceResolvable resolvable, boolean htmlEscape) throws NoSuchMessageException { String msg = this.webApplicationContext.getMessage(resolvable, getLocale()); return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code, @Nullable List<?> args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), getLocale()); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code, @Nullable Object[] args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, args, getLocale()); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, null, getLocale()); }
/** * Retrieve the given MessageSourceResolvable in the current theme. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param resolvable the MessageSourceResolvable * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(resolvable, getLocale()); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, null, defaultMessage, getLocale()); return (msg != null ? msg : ""); }
/** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, @Nullable Object[] args, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, args, defaultMessage, getLocale()); return (msg != null ? msg : ""); }
/** * Retrieve the message for the given code. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param htmlEscape if the message should be HTML-escaped * @return the message * @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()); return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); }
/** * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance). * @param resolvable the MessageSourceResolvable * @param htmlEscape if the message should be HTML-escaped * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(MessageSourceResolvable resolvable, boolean htmlEscape) throws NoSuchMessageException { String msg = this.webApplicationContext.getMessage(resolvable, getLocale()); return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); }
/** * Exposes JSTL-specific request attributes specifying locale * and resource bundle for JSTL's formatting and message tags, * using Spring's locale and MessageSource. * @param requestContext the context for the current HTTP request, * including the ApplicationContext to expose as MessageSource */ public static void exposeLocalizationContext(RequestContext requestContext) { Config.set(requestContext.getRequest(), Config.FMT_LOCALE, requestContext.getLocale()); TimeZone timeZone = requestContext.getTimeZone(); if (timeZone != null) { Config.set(requestContext.getRequest(), Config.FMT_TIME_ZONE, timeZone); } MessageSource messageSource = getJstlAwareMessageSource( requestContext.getServletContext(), requestContext.getMessageSource()); LocalizationContext jstlContext = new SpringLocalizationContext(messageSource, requestContext.getRequest()); Config.set(requestContext.getRequest(), Config.FMT_LOCALIZATION_CONTEXT, jstlContext); }