Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.view;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.beans.BeanUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Conventions;
import org.springframework.core.MethodParameter;
import org.springframework.core.Ordered;
import org.springframework.core.ReactiveAdapter;
import org.springframework.core.ReactiveAdapterRegistry;
import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.lang.Nullable;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.support.WebExchangeDataBinder;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.HandlerResultHandler;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.result.HandlerResultHandlerSupport;
import org.springframework.web.server.NotAcceptableStatusException;
import org.springframework.web.server.ServerWebExchange;
/**
* {@code HandlerResultHandler} that encapsulates the view resolution algorithm
* supporting the following return types:
*
*
{@link Void} or no value -- default view name
*
{@link String} -- view name unless {@code @ModelAttribute}-annotated
*
{@link View} -- View to render with
*
{@link Model} -- attributes to add to the model
*
{@link Map} -- attributes to add to the model
*
{@link Rendering} -- use case driven API for view resolution
*
{@link ModelAttribute @ModelAttribute} -- attribute for the model
*
Non-simple value -- attribute for the model
*
*
*
A String-based view name is resolved through the configured
* {@link ViewResolver} instances into a {@link View} to use for rendering.
* If a view is left unspecified (e.g. by returning {@code null} or a
* model-related return value), a default view name is selected.
*
*
By default this resolver is ordered at {@link Ordered#LOWEST_PRECEDENCE}
* and generally needs to be late in the order since it interprets any String
* return value as a view name or any non-simple value type as a model attribute
* while other result handlers may interpret the same otherwise based on the
* presence of annotations, e.g. for {@code @ResponseBody}.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
implements HandlerResultHandler, Ordered {
private static final Object NO_VALUE = new Object();
private static final Mono