001/*
002 * Copyright 2002-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.reactive.result.view;
018
019import java.util.Locale;
020
021import reactor.core.publisher.Mono;
022
023/**
024 * Contract to resolve a view name to a {@link View} instance. The view name may
025 * correspond to an HTML template or be generated dynamically.
026 *
027 * <p>The process of view resolution is driven through a ViewResolver-based
028 * {@code HandlerResultHandler} implementation called
029 * {@link ViewResolutionResultHandler
030 * ViewResolutionResultHandler}.
031 *
032 * @author Rossen Stoyanchev
033 * @since 5.0
034 * @see ViewResolutionResultHandler
035 */
036public interface ViewResolver {
037
038        /**
039         * Resolve the view name to a View instance.
040         * @param viewName the name of the view to resolve
041         * @param locale the locale for the request
042         * @return the resolved view or an empty stream
043         */
044        Mono<View> resolveViewName(String viewName, Locale locale);
045
046}