Reputation: 8652
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.
Upvotes: 1
Views: 247
Reputation: 17815
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.
Upvotes: 1
Reputation: 14061
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/
Upvotes: 0