Find Questions…

Close ×
First time here? Check out the FAQ!

Is method DownloadableResource.isResourceModified() named incorrectly?

Igor Sereda asked this question · 4,397 karma ·

From the JavaDoc:

/**
* Returns true if the plugin resource has been modified. The implementing class is responsible for
* setting any appropriate response codes or headers on the response.
*
* If the resource has been modified, the resource shouldn't be served.
*/
boolean isResourceModified(HttpServletRequest request, HttpServletResponse response);
What?? If resource has been modified, it should not be served? Isn't the logic normally the opposite?
Let's take a look at an implementation in AbstractDownloadableResource. Here's the JavaDoc:
/**
* Checks any "If-Modified-Since" header from the request against the
* plugin's loading time, since plugins can't be modified after they've been
* loaded this is a good way to determine if a plugin resource has been
* modified or not. If this method returns true, don't do any more
* processing on the request -- the response code has already been set to
* "304 Not Modified" for you, and you don't need to serve the file.
*/
So the method "isResourceModified()" returns true when it sets HTTP 304 response, "Not Modified".
Am I missing something? Shouldn't it be named isResourceNotModified() instead?
And if not, since this is an interface method, I guess it is too late to rename it - but probably someone should clear this up in the JavaDoc.
86 views

Igor Sereda · 4,397 karma ·

sorry about condensed text, I'm tired of fighting with the formatting controls here...

Looking for something else?

Find Questions…

or Browse other questions tagged:

or Ask a Question