0

My application ear is bundled with static resources like js, css, images, etc and was serving js files at URI app/scripts. These requests were passing through filters in the application. Now I configured WildFly to serve static contents like images, js and css. It is served at path app/scripts for js. Since both have same URI which one will be working now? It looks like static content is getting precedence because I noticed that now request are not passing through filters. Which method is better option to improve performance?

Valsaraj Viswanathan
  • 1,473
  • 5
  • 28
  • 51

1 Answers1

2

Hi Make your static contents as a separate deployment. And Create a folder named "MyContents.war" in deployment folder of your Wildfly and keep all your scripts, css what ever inside that folder, add the following settings in your standalone.xml file inside <server> tag.

<deployments>
        <deployment name="MyContents.war" runtime-name="MyContents.war">
            <fs-archive path="deployments\MyContents.war" relative-to="jboss.server.base.dir"/>
        </deployment>
 </deployments>

Now to access any resource like a script file for example scripts.js

  http://<yourhost>:<port>/MyContents/scripts/scripts.js 

Hope this helpful for you.

Kiran
  • 167
  • 2
  • 15
  • I have created a folder named static-content and added static contents inside it. Then added file handler in configuration file by specifying URI and path to the folder. Now the contents are accessible at the specified URI path like http://:/images/test.jpg – Valsaraj Viswanathan Aug 05 '15 at 16:28