Can you use the <virtual-directory-mapping> to reference static content inside the deployed EAR and will it provide any benefit?
Disclaimer: Ideally static resources like fonts, javascript and css should be served by the webserver and not the application container.
There are a number of articles on SO regarding <virtual-directory-mapping> in Weblogic. It is also well documented here and here.
My application is deployed in the following location:
c:\weblogic\deploy\ACME.ear
Inside ACME.ear there exists the following folder structure for CSS, Fonts and JS
store.war\include\js\script.js
store.war\include\js\function.js
store.war\include\fonts\font.woff
store.war\include\fonts\font.woff2
store.war\include\css\css-output\ie.css
store.war\include\css\css-output\interactive\large.css
store.war\include\css\css-output\interactive\small.css
My context root is specified as /store.
In normal operation I would be able to access my script.js in the site as follow:
http://www.acme.com/store/include/js/script.js
This request will then pass through my application request pipeline. What I am trying to achieve is to simply serve the contents of the /include/ folder, inside the .war as static documents without having to pass through the entire request pipeline (in my case ATG).
I've added the following lines to my weblogic.xml
<virtual-directory-mapping>
    <local-path>C:/weblogic/deploy/ACME.ear/store.war/include</local-path>
    <url-pattern>/include/css/*</url-pattern>
    <url-pattern>/include/fonts/*</url-pattern>
    <url-pattern>/include/js/*</url-pattern>
    <url-pattern>/include/lib/*</url-pattern>
</virtual-directory-mapping>    
In the hope that this will, instead of passing the request through the entire pipeline, simply render it as a static resource.
According to the documentation it will first try and render it via the <virtual-directory-mapping> before trying to render it from the container document root.
Even with the above configuration, the static content in the /include/ folder is still being rendered by the container and not as a static resource through Weblogic. I have the following questions:
- Is this even a valid approach? Even though the static assets exist in the .war, can I render it as 'external' static assets using the using the above configuration?
- Should the <url-pattern>include thecontext-root? Should the<local-path>include thecontext-root? (I've tried various combinations of including and excluding but to no avail)
- How do I access files in folders and subfolders using the <url-pattern>. Do I need to specify each subfolder?
 
    