I'm new in web development (spring-mvc), my background is from android world. I'm receiving images from service every 2 second, than I'm saving them to the WEB-INF/images folder, at this time every 1 second, I'm making ajax request to retrieve and display received image. This is how I'm making ajax call
function updateImage() {
$.get('/api/getCurrentImagePath/', function (frameImagePath) {
$("#targetImgView").attr("src", frameImagePath);
setTimeout(updateImage, 1000)
})
}
My problem is that, when function is invoked $("#targetImgView").attr("src", frameImagePath);
console logs http://localhost:8080/images/13456482154.jpg 404 not found error
but received image path is correct.
How can I resolve this issue? or is there any better way to do, what I'm trying to do?
P.S
when I save images into the webapp/images folder during the running server and trying to set the path of images it does not works, but if I restart the server and statically set the path of already saved images it works