public static boolean isCachedContentRequest ( final Request request ) { // Get target id on request String targetId = request . getParameter ( Environment . TARGET_ID ) ; if ( targetId == null ) { return false ; } // Get target ComponentWithContext targetWithContext = WebUtilities . getComponentById ( targetId , true ) ; if ( targetWithContext == null ) { return false ; } // Check for caching key WComponent target = targetWithContext . getComponent ( ) ; UIContextHolder . pushContext ( targetWithContext . getContext ( ) ) ; try { // TODO Look at implementing CacheableTarget interface String key = null ; if ( target instanceof WContent ) { key = ( ( WContent ) target ) . getCacheKey ( ) ; } else if ( target instanceof WImage ) { key = ( ( WImage ) target ) . getCacheKey ( ) ; } else if ( target instanceof WVideo ) { key = ( ( WVideo ) target ) . getCacheKey ( ) ; } else if ( target instanceof WAudio ) { key = ( ( WAudio ) target ) . getCacheKey ( ) ; } return ! Util . empty ( key ) ; } finally { UIContextHolder . popContext ( ) ; } }
Check if the request is for cached content .