javaiiswebobjects

WebObjects image caching


I want to cache the images returned by a WebObjects Java application on the client-side, by using the Cache-Control header.

The images are retrieved through calls like /Scripts/WebObjects.dll/App.woa/1/wr?wodata=1_9840_th

The web server uses IIS 8.5. I have tried to add the headers in the IIS configuration, without success. For some reason, they are not returned in the response.

The WOApplication is configured with setPageRefreshOnBacktrackEnabled(true), though I don't know if that affects images. I can see that cache-control: no-cache is returned for normal action URLs, but not for images.

How can I make sure my images are being cached by the browser when using WebObjects? I could not find anything related to this in the the WebObjects developer guide or in the WOImage documentation.


Solution

  • I doubt that setPageRefreshOnBacktrackEnabled affects the resource request handler (as it doesn't deal with components/pages).

    When in doubt, you could always register your own WORequestHandler for the wr key (WOApp.registerRequestHandler) and compose the WOResponse on your own.

    WO has a default handler for delivering resources which should be named something like WOResourceRequestHandler and you can look it up using WOApplication.requestHandlerForKey("wr").