1

I have a directory containing images. Images are added in it at any time, during runtime. I want to make these files visible through some url.

I tried to put this directory in wildfly webapp directory. But the images added at runtime are not visible.

How to make this directory accessible.

afzalex
  • 8,598
  • 2
  • 34
  • 61
  • You could find a detailed answer this link [how-can-i-serve-static-resources-from-outside-a-war-on-wildfly](http://stackoverflow.com/questions/34426082/how-can-i-serve-static-resources-from-outside-a-war-on-wildfly/34433166#34433166). – Sevan Dec 24 '15 at 14:30

2 Answers2

1

You can add a file handler in the undertow subsystem and map it to a URL. In CLI you'd execute something similar to the following to commands.

/subsystem=undertow/configuration=handler/file=images:add(directory-listing=true, follow-symlink=true, path=/path/to/image/directory)
/subsystem=undertow/server=default-server/host=default-host/location=\/images:add(handler=images)

That would list all the images on localhost:8080/images. You can turn off the directory listing and/or use a complete image URL to see the specific image.

James R. Perkins
  • 16,800
  • 44
  • 60
0

In your deployments, create a new directory with the .war extension, as:

$WILDFLY_HOME/standalone/deployments/images.war/

This is an "exploded" deployment, and any new images added there can be reached via:

http://localhost:8080/images/
jpkroehling
  • 13,881
  • 1
  • 37
  • 39