Java Code Examples for org.springframework.web.reactive.config.ResourceHandlerRegistry

The following examples show how to use org.springframework.web.reactive.config.ResourceHandlerRegistry. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openapi-generator   Source File: OpenAPI2SpringBoot.java    License: Apache License 2.0 6 votes vote down vote up
@Bean
public WebFluxConfigurer webConfigurer() {
    return new WebFluxConfigurer() {
        /*@Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedOrigins("*")
                    .allowedMethods("*")
                    .allowedHeaders("Content-Type");
        }*/

        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
            registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/3.14.2/");
        }
    };
}
 
Example 2
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
	registry.addResourceHandler("/doc.html")
		.addResourceLocations("classpath:/META-INF/resources/");
	registry.addResourceHandler("/webjars/**")
		.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
 
Example 3
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
	StringBuilder uiRootPath = new StringBuilder();
	if (swaggerPath.contains("/")) {
		uiRootPath.append(swaggerPath, 0, swaggerPath.lastIndexOf('/'));
	}
	registry.addResourceHandler(uiRootPath + webJarsPrefixUrl + "/**")
			.addResourceLocations(CLASSPATH_RESOURCE_LOCATION + DEFAULT_WEB_JARS_PREFIX_URL + DEFAULT_PATH_SEPARATOR)
			.resourceChain(false)
			.addTransformer(swaggerIndexTransformer);
}
 
Example 4
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {

    registry.addResourceHandler("/swagger-ui.html**")
            .addResourceLocations("classpath:/META-INF/resources/");

    registry.addResourceHandler("/webjars/**")
            .addResourceLocations("classpath:/META-INF/resources/webjars/");
}
 
Example 5
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("classpath:/static/");
}