How to configure static resources in jBoss AS 7

前端 未结 2 1383
南方客
南方客 2021-01-11 18:29

I\'d like to upload images to the server, store them in file system (outside server) and then display them on my JSF page.

I\'d like to find something like this:

相关标签:
2条回答
  • 2021-01-11 18:46

    This method documented on the JBoss forums works for us in loading all the static resources from an exploded folder - which has to sit within JBOSS_HOME but at least not packaged in EAR/WAR.

    https://community.jboss.org/wiki/HowToPutAnExternalFileInTheClasspath

    I had to create a module folder called com/mycompany/main and add all the images in there.

    Skip step 3 and use step 4 instead. (Manifest.MF entry - which works)

    The image is now loaded using

    URL imgUrl = this.getClass().getClassLoader().getResource("myimage.jpg");

    0 讨论(0)
  • 2021-01-11 19:01

    Finally, I've decided to use FileServlet implemented by BalusC (link). This solution suits me for now. I've only changed its basePath to some certain path on my server.

    0 讨论(0)
提交回复
热议问题