All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.the_qa_company.qendpoint.config.WebMvcConfig Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.the_qa_company.qendpoint.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

	// this is the configuration necessary for the react front-end, it redirects
	// to index.html if no match
	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/").setViewName("forward:/index.html");
		// Single directory level - no need to exclude "api"
		registry.addViewController("/{x:[\\w\\-]+}").setViewName("forward:/index.html");
		// Multi-level directory path, need to exclude "api" on the first part
		// of the path
//    registry
//        .addViewController("/{x:^(?!api$).*$}/{y:[\\w\\-]+}")
//        .setViewName("forward:/index.html");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy