if (!(imageReference instanceof StreamImageReference)) {
throw new IOException("Image is not a StreamImageReference.");
}
StreamImageReference streamImageReference = (StreamImageReference) imageReference;
conn.setContentType(new ContentType(streamImageReference.getContentType(), true));
streamImageReference.render(conn.getOutputStream());
} catch (IOException ex) {
// Internet Explorer appears to enjoy making half-hearted requests for images, wherein it resets the connection
// leaving us with an IOException. This exception is silently eaten.
// It would preferable to only ignore SocketExceptions, however the API documentation does not provide
// enough information to suggest that such a strategy would be adequate..