-
-
Notifications
You must be signed in to change notification settings - Fork 523
Webflux webjars path cannot be prefixed with a context root #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
webjars are not only linked to webflux. They are used by swagger-ui. @Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/dave/webjars/**").addResourceLocations("/webjars/").resourceChain(false);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/webjars/swagger-ui/index.html", "/dave/webjars/swagger-ui/index.html")
.setKeepQueryParams(true);
}
@Bean
public ViewResolver getViewResolver() {
return new InternalResourceViewResolver();
}
} On webflux side, unlike Spring MVC at present in WebFlux there is no way to transparently rewrite static resource URLs since the are no view technologies that can make use of a non-blocking chain of resolvers and transformers (e.g. resources on Amazon S3). When serving only local resources the workaround is to use ResourceUrlProvider directly (e.g. through a custom tag) and block for 0 seconds. |
Set
|
Regarding the demo springdoc-openapi-test-app3 (3.1.1-SNAPSHOT) if I set the following
then
http://localhost:8080/dave/swagger-ui.html
redirects to
http://localhost:8080/webjars/swagger-ui/index.html?url=/dave/v3/api-docs&validatorUrl=
but should be
http://localhost:8080/dave/webjars/swagger-ui/index.html?url=/dave/v3/api-docs&validatorUrl=
is this a bug or is it possible to have a parameter to prefix /webjars?
Thanks
The text was updated successfully, but these errors were encountered: