Everything works fine, the first image from the queue (called "coada" in my code) is displayed correctly. I added a cookie containing its ID, so that i won't display the same image if it had b een displayed a number of times. However, when i refresh the page containing the script i get no cookies from request.getCookies();