/* 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.flowable.admin.conf;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.web.WebMvcRegistrationsAdapter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;

@Configuration
@ComponentScan(basePackages = {
    "org.flowable.admin.app.rest",
    "org.flowable.app.rest"})
public class DispatcherServletConfiguration extends WebMvcRegistrationsAdapter {

    private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class);

    @Bean
    public ViewResolver contentNegotiatingViewResolver() {
        LOGGER.debug("Configuring the ContentNegotiatingViewResolver");
        ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
        List<ViewResolver> viewResolvers = new ArrayList<>();

        UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
        urlBasedViewResolver.setViewClass(JstlView.class);
        urlBasedViewResolver.setPrefix("/WEB-INF/pages/");
        urlBasedViewResolver.setSuffix(".jsp");
        viewResolvers.add(urlBasedViewResolver);

        viewResolver.setViewResolvers(viewResolvers);

        List<View> defaultViews = new ArrayList<>();
        defaultViews.add(new MappingJackson2JsonView());
        viewResolver.setDefaultViews(defaultViews);

        return viewResolver;
    }

    @Bean
    public SessionLocaleResolver localeResolver() {
        return new SessionLocaleResolver();
    }

    @Bean
    public LocaleChangeInterceptor localeChangeInterceptor() {
        LOGGER.debug("Configuring localeChangeInterceptor");
        LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
        localeChangeInterceptor.setParamName("language");
        return localeChangeInterceptor;
    }

    @Override
    public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
        LOGGER.debug("Creating requestMappingHandlerMapping");
        RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
        requestMappingHandlerMapping.setUseSuffixPatternMatch(false);
        Object[] interceptors = {localeChangeInterceptor()};
        requestMappingHandlerMapping.setInterceptors(interceptors);
        return requestMappingHandlerMapping;
    }
}

@@ -591,60 +591,8 @@
 f;%0A%0A
-import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 impo
@@ -900,106 +900,8 @@
 on;%0A
-import org.springframework.web.servlet.View;%0Aimport org.springframework.web.servlet.ViewResolver;%0A
 impo
@@ -1126,278 +1126,8 @@
 ing;
-%0Aimport org.springframework.web.servlet.view.ContentNegotiatingViewResolver;%0Aimport org.springframework.web.servlet.view.JstlView;%0Aimport org.springframework.web.servlet.view.UrlBasedViewResolver;%0Aimport org.springframework.web.servlet.view.json.MappingJackson2JsonView;
 %0A%0A@C
@@ -1427,854 +1427,8 @@
 );%0A%0A
-    @Bean%0A    public ViewResolver contentNegotiatingViewResolver() %7B%0A        LOGGER.debug(%22Configuring the ContentNegotiatingViewResolver%22);%0A        ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();%0A        List%3CViewResolver%3E viewResolvers = new ArrayList%3C%3E();%0A%0A        UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();%0A        urlBasedViewResolver.setViewClass(JstlView.class);%0A        urlBasedViewResolver.setPrefix(%22/WEB-INF/pages/%22);%0A        urlBasedViewResolver.setSuffix(%22.jsp%22);%0A        viewResolvers.add(urlBasedViewResolver);%0A%0A        viewResolver.setViewResolvers(viewResolvers);%0A%0A        List%3CView%3E defaultViews = new ArrayList%3C%3E();%0A        defaultViews.add(new MappingJackson2JsonView());%0A        viewResolver.setDefaultViews(defaultViews);%0A%0A        return viewResolver;%0A    %7D%0A%0A
     

Remove not needed content negotiation resolver