title: Protecting resources such as images in a servlet
body: <p>Let's say that you have an image I that you only want users who have logged into your website to be able to see. What is the best way to protect I from non-logged in users. One possible way is to have a page where you pass the image name via get or post parameters, and it would return the image by reading the image from disk and writing back in the response based on if the user was logged in the session. Is/Are there better ways to achieve security of resources more efficiently?</p>