Question: From within an HttpServlet doGet method, is it possible to know whether the servlet URL was accessed via an IMG SRC, as opposed to being typed in a browser address bar?

**UPDATE**

This is my actual HTML.

```
<a href="#" onclick="openwindow('/image/display?imageId=${image.id}'); return false;"><img width="50px" alt="${image.originalName}" src="/image/display?imageId=${image.id}" /></a>

```

As you can see, it displays a small thumbnail, inline in the page, but if you click on it, it opens full-size in a new window.

My DisplayImageServlet is behind /image/display. I need some slightly different logic inside the servlet for thumbnail as opposed to full-size.

Ideally I would like a solution that does not involve changing the HTML references. Other developers in my team may add HTML references to the servlet and not appreciate the subtlety.

Answer: 
User can type whatever in the browser address bar. So your url should be not predictable. 
Add something (like session id plus current time) to your url from the image (or whatever on the page) and verify that requested url has this value right.
In this case user can try to emulate or cut&paste previous url but server will know that it was not from this particular page.
If it is doGet() then it should attach parameter into url path and you should be able to get that parameter using request.getParameter() in your code.