I'm try to make the following URLs resolve to the same resources on my server:
http://myhost/website/content/css/theme.css
http://myhost/subsite/app/website/content/css/theme.css
and generically:
http://myhost/{any non-/ string}/app/website/content/css/theme.css
The following config successfully resolves:
http://myhost/website/content/css/theme.css
but stubbornly refused to resolve any */app URLs:
@Configuration
@EnableWebMvc
class WebMVCConfig extends WebMvcConfigurerAdapter {
override def addResourceHandlers(registry: ResourceHandlerRegistry): Unit = {
// servlet context URL path pattern --> webapp_relative_path
registry.addResourceHandler("/css/**").addResourceLocations("/css/")
registry.addResourceHandler("/js/**").addResourceLocations("/js/")
registry.addResourceHandler("/website/**").addResourceLocations("/website/")
registry.addResourceHandler("/index.html").addResourceLocations("/index.html")
// subsite redirects
registry.addResourceHandler("/*/app/index.html").addResourceLocations("/index.html")
registry.addResourceHandler("/*/app/website/**").addResourceLocations("/website/")
registry.addResourceHandler("/*/app/css/**").addResourceLocations("/css/")
registry.addResourceHandler("/*/app/js/**").addResourceLocations("/js/")
registry.addResourceHandler("/*/app/**").addResourceLocations("/")
}
What's up with that?
NB.
- The servlet context is ROOT (/).
- All content is in /src/main/webapp/ (ie. /src/main/webapp/website/content/css/theme.css exists)