@Override public Rendering.RedirectBuilder contextRelative(boolean contextRelative) { getRedirectView().setContextRelative(contextRelative); return this; }
/** * 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()); }
/** * Create a new builder for a redirect through a {@link RedirectView}. * @param url the redirect URL * @return the builder */ static RedirectBuilder redirectTo(String url) { return new DefaultRenderingBuilder(new RedirectView(url)); }
/** * 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()); }
/** * Create a RequestContext to expose under the specified attribute name. * <p>The default implementation creates a standard RequestContext instance * for the given request and model. Can be overridden in subclasses for * custom instances. * @param exchange current exchange * @param model combined output Map (never {@code null}), * with dynamic values taking precedence over static attributes * @return the RequestContext instance * @see #setRequestContextAttribute */ protected RequestContext createRequestContext(ServerWebExchange exchange, Map<String, Object> model) { return new RequestContext(exchange, model, obtainApplicationContext(), getRequestDataValueProcessor()); }
@Override public Rendering.RedirectBuilder propagateQuery(boolean propagate) { getRedirectView().setPropagateQuery(propagate); return this; }
/** * Set the view names (or name patterns) that can be handled by this view * resolver. View names can contain simple wildcards such that 'my*', '*Report' * and '*Repo*' will all match the view name 'myReport'. * @see UrlBasedViewResolver#setViewNames */ public UrlBasedViewResolverRegistration viewNames(String... viewNames) { this.viewResolver.setViewNames(viewNames); return this; }
/** * Set the view class that should be used to create views. * @see UrlBasedViewResolver#setViewClass */ public UrlBasedViewResolverRegistration viewClass(Class<?> viewClass) { this.viewResolver.setViewClass(viewClass); return this; }
/** * 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(); }
/** * Set the suffix that gets appended to view names when building a URL. * @see UrlBasedViewResolver#setSuffix */ public UrlBasedViewResolverRegistration suffix(String suffix) { this.viewResolver.setSuffix(suffix); return this; }
/** * 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 {@code RedirectView} with the given URL and an alternate * redirect status code such as {@link HttpStatus#TEMPORARY_REDIRECT} or * {@link HttpStatus#PERMANENT_REDIRECT}. */ public RedirectView(String redirectUrl, HttpStatus statusCode) { super(redirectUrl); setStatusCode(statusCode); }
/** * Set the prefix that gets prepended to view names when building a URL. * @see UrlBasedViewResolver#setPrefix */ public UrlBasedViewResolverRegistration prefix(String prefix) { this.viewResolver.setPrefix(prefix); return this; }
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); }
/** * Create a new builder for response rendering based on the given view name. * @param name the view name to be resolved to a {@link View} * @return the builder */ static Builder<?> view(String name) { return new DefaultRenderingBuilder(name); }
@Override public Rendering build() { return new DefaultRendering(this.view, this.model, this.status, this.headers); }
/** * 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()); }
/** * Return the first error message for the field or object, if any. */ public String getErrorMessage() { String[] errorMessages = initErrorMessages(); return (errorMessages.length > 0 ? errorMessages[0] : ""); }
/** * 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()); }