Repeating image fetched every time.

I am displaying results with an image (icon) next to it. I have noticed that for each image displayed, it is making an new request to fetch the image from a unique path. If I have 100 results, that is 100 fetches for the (same) image.
Is there a better aproach so the image path is always the same?

Here is my code:

FileResource resource = new FileResource(new File( basepath + "/WEB-INF/img/recordtypes/" + (recordType == null ? "webcontent" : recordType.toLowerCase()) + ".png")); image = new Image(null, resource); Produces:



Is the file resource created for each result or just once?

It is in a Table component, Table.ColumnGenerator and is based on the data row. So I see I could possibly set it up once, store it in a field and check to see if that image type exists already before re-creating it.

is that the only way? btw, I am not interested in doing a css alternative.

Well, that’s one way. CSS is your friend, don’t be afraid to dabble in it. :slight_smile:

I went ahead and put the images in the theme folder and used ThemeResource instead of a FileRe