I don't quite understand your last question (because I don't know what you mean by a resource callback), but if you're asking whether you can rely on the browser cache to handle "hasn't changed / matches" responses from conditional requests, the answer is yes. But that only covers browsers. If you have a programmatic client, like a Restlet ClientResource-based program, you have to manage client-side caching yourself. I don't think Restlet has any built-in support for that.
--tim On Fri, Jan 27, 2012 at 12:02 PM, Koen Maes <[email protected]> wrote: > I now have this HTTP traffic, using ETags and modification date, which is > perfect : > > Request > GET Entity > If-non-match [104-1327680277477] > If-modified-since Fri Jan 27 17:04:37 CET 2012 > Cache directives [] > Response 304 > Description Not Modified > Entity LastModified > Cache directives [] > ETag "104-1327680277477" > > In the resource callback, the entity is NULL because response is 304. So I > have to keep a variable at all time of the old version, right ? > Is it possible to still get a cached copy in the callback, maybe relying > on the browser cache ? > > > On Fri, Jan 27, 2012 at 9:28 AM, Koen Maes <koen at koma dot be> wrote: > > > > > double checking, and handle does not provide req, resp as parameters, > > > either. > > > > > > > Are you talking about ServerResource.handle()? You probably shouldn't > > override that if you're using annotated methods. > > > > > > But in the flow of handling, I assume everything is done overriding > > > handle() whereas I am unsure at one point in the overall handling > > > "toRepresentation(...)" is being called. > > > That's why I opted for overriding handle() > > > > > > > toRepresentation is called when converting the return value of the > > annotated handler method to a representation. It's really the ideal place > > to copy values from the returned object into the representation metadata. > > Call super.toRepresentation(source, target) to get the representation, > and > > then use whatever machinery you need to get information out of the source > > and into that representation. > > > > --tim > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2911901 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2911935

