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

The following examples show how to use org.springframework.web.reactive.config.ResourceHandlerRegistry. 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 File: OpenAPI2SpringBoot.java    From openapi-generator with 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
Source File: SwaggerAutoConfiguration.java    From mica with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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
Source File: SwaggerWebFluxConfigurer.java    From springdoc-openapi with Apache License 2.0 5 votes vote down vote up
@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
Source File: WebfluxConfig.java    From spring-boot-webflux-swagger-starter with MIT License 5 votes vote down vote up
@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
Source File: WebfluxConfig.java    From Hands-On-Reactive-Programming-with-Reactor with MIT License 4 votes vote down vote up
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("classpath:/static/");
}