tsgrp / OpenContent

TSG's Web Services for ECM Repositories
8 stars 4 forks source link

RESTContent get full content even in the case of a cached response #51

Closed benallenallen closed 9 years ago

benallenallen commented 9 years ago

The very first thing that we do in RESTContent is

ContentResult result = CoreContext.getContent().enhancedGetObject(ticket, id, contentTypeArray);

This negates the idea of us trying to save time by using the "HEADER_IF_MODIFIED_SINCE" parameter since if the content is large, we have to stream the whole thing to the OC server just to see if the modifyDate is greater than what the client has in its header.

The better way to do this would be to just call enhancedGetProperties and immediately do the check against the property that comes back rather than all of the processing in-between only to later check if we even need to be doing any processing on the server and just returning a 304.

gsteimer commented 9 years ago

@benallenallen @b-k-white - do the methods in RESTConfigService have this same issue? Looking at the code in getConfigByName for example, I think they do. It calls getObjectByPath in order to get an OCO, which I think is fine. However, it then calls CoreContext.getContent().getContent() before doing the modified date check.

benallenallen commented 9 years ago

Same deal with RestUserPreferencesService#getUserPreferenceByName

ghost commented 9 years ago

Fixed by changing the order of things to correctly check the modified date before grabbing the full content in all 4 locations we discovered. CR-Ballen,George OC-REV-10213