Reputation: 27
I have a war file that I have deployed which contains an images folder in the WEB-APP
directory. I tried accessing the images stored in the folder using
"localhost:8080/testapp/images/image1.jpg" but I am getting a 404 response. Can someone please help me with this?
Thanks in advance.
Upvotes: 0
Views: 3744
Reputation: 13473
Your images directory needs to be a sibling of WEB-INF, not a child of it. Try this:
your-war-file.war
|-images/
| |-image1.jpg
| |-image2.jpg
| `-image3.jpg
|-WEB-INF/
| |-classes/
| |-lib/
| `-web.xml
|-index.html
`-404.html
Upvotes: 2
Reputation: 1050
how to read from path ? use ("."+File.seperator+"some else") path of File for current path into your code or html file
Upvotes: 0
Reputation: 160181
Clients may not directly access artifacts under WEB-INF.
Put them in a location directly accessible if you're not streaming them from an app endpoint.
Upvotes: 0
Reputation: 992
Assuming you have your folder 'images' in the base directory for this web app (on the same level as 'META-INF' and 'WEB-INF' catalogs), the path seems correct. Maybe check that you haven't put 'images' folder inside 'WEB-INF' where it is not accessible? If that doesn't work, try accessing some other file inside your web app to check that it was deployed on server.
Upvotes: 0