I am using a button with a FileResource for its icon. It works fine except I’m trying to manipulate the browser’s caching of the button’s image. The user may upload a new image during execution, and when they do, I would like to be able to play the cache trick where I generate a new image version and append that version to the image URL as through it were a query parameter. The resulting html would look something like this for version 17 of the image:
I cannot find a way to manipulate the URL that the browser sees in this manner; where by I set a query parameter on the FileResource
I found an answer. I derived a class from FileResource which allows me to set the query parameters, using that derived class in my code. I then overrode the getFilename() method, appending the query parameters if they are provided.
I stand corrected. That appraoch allows me to manipulate the URL so that I can add a version to the end, however, the connector portion of the URL changes with a page reload. Hence, the URL is different even when is file name and version number are the same. ResourceReference.getUrl() seems to be relying on connector ID, which is changing whenever the page reloads, defeating any efforts to cache. Meanwhile, the actual file remains the same.