简体   繁体   中英

Access files inside workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\

I have a spring web project which basically Test webApp and capture screenshot of pages. The path of the saved image looks something like below:

"\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
 \Demo\WEB-INF\Results\Test\1118015800\error\error_ST001_1.jpg"

I am trying to display the saved image on a JSP page and so far success has been elusive. I tried different combination of relative path also I tried to give absolute path but it doesn't work. My image tag looks something like this

<img src="<c:url value="/WEB-INF/Results/Test/1118015800/error/error_ST001_1.jpg" />" />

Does anyone have any idea on displaying the image? Could it be because files are stored inside the .metadata folder of Eclipse workspace that I am not able to display any image?

This is because the WEB-INF directory is special. The web container won't serve files from that location - that behavior is defined in the Servlet Spec.

You can either create a servlet that takes requests from the client, loads images (eg using getResourceAsStream() ) and streams them back, or move the images to a different place in your web app hierarchy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM