/** * Create a BindStatus for the given bind object, using the "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will be resolved (e.g. "person.age") * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path) throws IllegalStateException { return new BindStatus(this, path, isDefaultHtmlEscape()); }
/** * This implementation checks for a JSTL time zone attribute in page, * request, session or application scope; if not found, returns {@code null}. */ @Override protected TimeZone getFallbackTimeZone() { if (jstlPresent) { TimeZone timeZone = JstlPageLocaleResolver.getJstlTimeZone(getPageContext()); if (timeZone != null) { return timeZone; } } return null; }
/** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getMessage(String code, String defaultMessage) { return getMessage(code, null, defaultMessage, isDefaultHtmlEscape()); }
@Override public Locale getRequestLocale() { return RequestContextUtils.getLocale(request); } };
/** * @see org.springframework.web.servlet.support.RequestContext#getBindStatus(String) */ public BindStatus getBindStatus(String path) throws IllegalStateException { return new BindStatus(new RequestContext(this.request), path, false); }
/** * Same as {@link #fromContextPath(HttpServletRequest)} except the * request is obtained through {@link RequestContextHolder}. */ public static ServletUriComponentsBuilder fromCurrentContextPath() { return fromContextPath(getCurrentRequest()); }
/** * Same as {@link #fromServletMapping(HttpServletRequest)} except the * request is obtained through {@link RequestContextHolder}. */ public static ServletUriComponentsBuilder fromCurrentServletMapping() { return fromServletMapping(getCurrentRequest()); }
/** * Same as {@link #fromRequest(HttpServletRequest)} except the * request is obtained through {@link RequestContextHolder}. */ public static ServletUriComponentsBuilder fromCurrentRequest() { return fromRequest(getCurrentRequest()); }
@Override public FlashMap getFlashMap() { return RequestContextUtils.getOutputFlashMap(this.mockRequest); }
@Override public String processFormFieldValue(HttpServletRequest request, String name, String value, String type) { return (this.processor != null) ? this.processor.processFormFieldValue(request, name, value, type) : value; }
/** * Same as {@link #fromRequestUri(HttpServletRequest)} except the * request is obtained through {@link RequestContextHolder}. */ public static ServletUriComponentsBuilder fromCurrentRequestUri() { return fromRequestUri(getCurrentRequest()); }
/** * Return the current theme (never {@code null}). * <p>Resolved lazily for more efficiency when theme support is not being used. */ public Theme getTheme() { if (this.theme == null) { // Lazily determine theme to use for this RequestContext. this.theme = RequestContextUtils.getTheme(this.request); if (this.theme == null) { // No ThemeResolver and ThemeSource available -> try fallback. this.theme = getFallbackTheme(); } } return this.theme; }
/** * Create a BindStatus for the given bind object, using the "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will be resolved (e.g. "person.age") * @param htmlEscape create a BindStatus with automatic HTML escaping? * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path, boolean htmlEscape) throws IllegalStateException { return new BindStatus(this, path, htmlEscape); }
/** * Create a new WebContentGenerator. * @param supportedMethods the supported HTTP methods for this content generator */ public WebContentGenerator(String... supportedMethods) { setSupportedMethods(supportedMethods); }
/** * Return the first error message for the field or object, if any. */ public String getErrorMessage() { String[] errorMessages = initErrorMessages(); return (errorMessages.length > 0 ? errorMessages[0] : ""); }
/** * Return the current Locale (falling back to the request locale; never {@code null}). * <p>Typically coming from a DispatcherServlet's {@link LocaleResolver}. * Also includes a fallback check for JSTL's Locale attribute. * @see RequestContextUtils#getLocale */ public final Locale getLocale() { return (this.locale != null ? this.locale : getFallbackLocale()); }
/** * @see org.springframework.web.servlet.support.RequestContext#getBindStatus(String, boolean) */ public BindStatus getBindStatus(String path, boolean htmlEscape) throws IllegalStateException { return new BindStatus(new RequestContext(this.request), path, true); }
/** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code) throws NoSuchMessageException { return getMessage(code, null, isDefaultHtmlEscape()); }
/** * Return the resolved error messages for the field or object, * if any. Returns an empty array instead of null if none. */ public String[] getErrorMessages() { return initErrorMessages(); }
/** * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance), using the "defaultHtmlEscape" setting. * @param resolvable the MessageSourceResolvable * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException { return getMessage(resolvable, isDefaultHtmlEscape()); }