Spring-boot serving content outside context root and getting content as resources -



Spring-boot serving content outside context root and getting content as resources -

i've added new resources handler "outside context root" next configureradapter:

@configuration public class dynamicassetsconfigurer extends webmvcconfigureradapter { @override public void addresourcehandlers(resourcehandlerregistry registry) { registry.addresourcehandler("/dynamicassets/**") .addresourcelocations("file:/var/dynamicassets/"); super.addresourcehandlers(registry); } }

handler works fine when making requests server, access content of "/dynamicassets/**" resources. can access "static assets" (assets directory within context root):

@inject private webapplicationcontext webcontext; public resource[] getstaticassetresources() { // returns array of servletresource objects homecoming webcontext.getresources( "/assets/*.*"); } public resource[] getdynamicassetresources() { // fails resources, because // dynamicassets not found context homecoming webcontext.getresources( "/dynamicassets/*.*"); }

how access files in "/dynamicassets/" servletresource objects ?

spring resources spring-boot

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -