@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); }
@Override public Mono<View> resolveViewName(String viewName, Locale locale) { if (!canHandle(viewName, locale)) { return Mono.empty(); } AbstractUrlBasedView urlBasedView; if (viewName.startsWith(REDIRECT_URL_PREFIX)) { String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length()); urlBasedView = this.redirectViewProvider.apply(redirectUrl); } else { urlBasedView = createView(viewName); } View view = applyLifecycleMethods(viewName, urlBasedView); try { return (urlBasedView.checkResourceExists(locale) ? Mono.just(view) : Mono.empty()); } catch (Exception ex) { return Mono.error(ex); } }
@Override public void afterPropertiesSet() throws Exception { if (getUrl() == null) { throw new IllegalArgumentException("Property 'url' is required"); } }
/** * Creates a new View instance of the specified view class and configures it. * Does <i>not</i> perform any lookup for pre-defined View instances. * <p>Spring lifecycle methods as defined by the bean container do not have to * be called here: They will be automatically applied afterwards, provided * that an {@link #setApplicationContext ApplicationContext} is available. * @param viewName the name of the view to build * @return the View instance * @see #getViewClass() * @see #applyLifecycleMethods */ protected AbstractUrlBasedView createView(String viewName) { Class<?> viewClass = getViewClass(); Assert.state(viewClass != null, "No view class"); AbstractUrlBasedView view = (AbstractUrlBasedView) BeanUtils.instantiateClass(viewClass); view.setSupportedMediaTypes(getSupportedMediaTypes()); view.setRequestContextAttribute(getRequestContextAttribute()); view.setDefaultCharset(getDefaultCharset()); view.setUrl(getPrefix() + viewName + getSuffix()); return view; }
@Override public void setApplicationContext(@Nullable ApplicationContext context) { super.setApplicationContext(context);
/** * Creates a new View instance of the specified view class and configures it. * Does <i>not</i> perform any lookup for pre-defined View instances. * <p>Spring lifecycle methods as defined by the bean container do not have to * be called here; those will be applied by the {@code loadView} method * after this method returns. * <p>Subclasses will typically call {@code super.buildView(viewName)} * first, before setting further properties themselves. {@code loadView} * will then apply Spring lifecycle methods at the end of this process. * @param viewName the name of the view to build * @return the View instance */ protected AbstractUrlBasedView createUrlBasedView(String viewName) { AbstractUrlBasedView view = (AbstractUrlBasedView) BeanUtils.instantiateClass(getViewClass()); view.setSupportedMediaTypes(getSupportedMediaTypes()); view.setRequestContextAttribute(getRequestContextAttribute()); view.setDefaultCharset(getDefaultCharset()); view.setUrl(getPrefix() + viewName + getSuffix()); return view; }
@Override public String toString() { return super.toString() + "; URL [" + getUrl() + "]"; }
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); if (getConfiguration() == null) { FreeMarkerConfig config = autodetectConfiguration(); setConfiguration(config.getConfiguration()); } }
@Override public Mono<View> resolveViewName(String viewName, Locale locale) { if (!canHandle(viewName, locale)) { return Mono.empty(); } AbstractUrlBasedView urlBasedView; if (viewName.startsWith(REDIRECT_URL_PREFIX)) { String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length()); urlBasedView = this.redirectViewProvider.apply(redirectUrl); } else { urlBasedView = createUrlBasedView(viewName); } View view = applyLifecycleMethods(viewName, urlBasedView); try { return (urlBasedView.checkResourceExists(locale) ? Mono.just(view) : Mono.empty()); } catch (Exception ex) { return Mono.error(ex); } }
@Override public void afterPropertiesSet() throws Exception { if (getUrl() == null) { throw new IllegalArgumentException("Property 'url' is required"); } }
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); if (getStatusCode() == null) { throw new IllegalArgumentException("Property 'statusCode' is required"); } }
@Override public String toString() { return super.toString() + "; URL [" + getUrl() + "]"; }
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); if (getConfiguration() == null) { FreeMarkerConfig config = autodetectConfiguration(); setConfiguration(config.getConfiguration()); } }