@@ -244,58 +244,30 @@ public boolean processHeaders(String queryId, IHttpServletRequest myServletReque
244244 {
245245 setTheme (theme );
246246 }
247- String eTag = isPostRequest ( myServletRequest ) ? null : myServletRequest .getHeader ("If-Modified-Since" );
247+ String etag = myServletRequest . getMethod (). equalsIgnoreCase ( POST ) ? null : myServletRequest .getHeader ("If-Modified-Since" );
248248 Date dt = Application .getStartDateTime ();
249249 Date newDt = new Date ();
250250 GXSmartCacheProvider .DataUpdateStatus status ;
251251 Date [] newDt_arr = new Date [] { newDt };
252- if (eTag == null )
252+ if (etag == null )
253253 {
254254 status = GXSmartCacheProvider .DataUpdateStatus .Invalid ;
255- GXSmartCacheProvider .checkDataStatus (queryId , dt , newDt_arr );
255+ GXSmartCacheProvider .CheckDataStatus (queryId , dt , newDt_arr );
256256 }
257257 else
258258 {
259- dt = HTMLDateToDatetime (eTag );
260- status = GXSmartCacheProvider .checkDataStatus (queryId , dt , newDt_arr );
259+ dt = HTMLDateToDatetime (etag );
260+ status = GXSmartCacheProvider .CheckDataStatus (queryId , dt , newDt_arr );
261261 }
262262 newDt = newDt_arr [0 ];
263- addHeader (myServletResponse , "Last-Modified" , DateTimeToHTMLDate ( newDt ));
264- addCacheHeaders ( myServletResponse );
263+ if (myServletResponse != null ) // Temporary: Jersey Service called through AWS Lambda where HttpResponse is null.
264+ myServletResponse . addHeader ( "Last-Modified" , DateTimeToHTMLDate ( newDt ) );
265265 if (status == GXSmartCacheProvider .DataUpdateStatus .UpToDate )
266266 {
267267 return false ;
268268 }
269269 return true ;
270270 }
271-
272- private void addCacheHeaders (IHttpServletResponse myServletResponse ) {
273- /*
274- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
275- * Specifying no-cache or max-age=0 indicates that
276- * clients can cache a resource and must revalidate each time before using it.
277- * This means HTTP request occurs each time, but it can skip downloading HTTP body if the content is valid.
278- */
279- if (ClientInformation .getDeviceType () == ClientInformation .DeviceTypeEnum .Web ) {
280- addHeader (myServletResponse , "Cache-Control" , "no-cache, max-age=0" );
281- }
282- }
283-
284- boolean isPostRequest (IHttpServletRequest request )
285- {
286- return request .getMethod ().equalsIgnoreCase (POST );
287- }
288-
289- void addHeader (IHttpServletResponse response , String headerName , String headerValue )
290- {
291- if (response != null ) {
292- // Temporary: Jersey Service called through AWS Lambda where HttpResponse is null.
293- response .addHeader (headerName , headerValue );
294- }
295- else {
296- logger .warn ("Could add HttpHeader to Response" );
297- }
298- }
299271
300272 Date HTMLDateToDatetime (String s )
301273 {
0 commit comments