@ Override public RequestCallback filter ( Method method , Response response , RequestCallback callback ) { int code = response . getStatusCode ( ) ; final CacheKey ck = cacheKey ( method . builder ) ; final List < RequestCallback > removedCallbacks = cache . removeCallbacks ( ck ) ; if ( removedCallbacks != null ) { callback = new RequestCallback ( ) { @ Override public void onResponseReceived ( Request request , Response response ) { if ( GWT . isClient ( ) && LogConfiguration . loggingIsEnabled ( ) ) { Logger . getLogger ( CachingCallbackFilter . class . getName ( ) ) . finer ( "call " + removedCallbacks . size ( ) + " more queued callbacks for " + ck ) ; } // call all callbacks found in cache for ( RequestCallback cb : removedCallbacks ) { cb . onResponseReceived ( request , response ) ; } } @ Override public void onError ( Request request , Throwable exception ) { if ( LogConfiguration . loggingIsEnabled ( ) ) { Logger . getLogger ( CachingCallbackFilter . class . getName ( ) ) . severe ( "cannot call " + ( removedCallbacks . size ( ) + 1 ) + " callbacks for " + ck + " due to error: " + exception . getMessage ( ) ) ; } if ( LogConfiguration . loggingIsEnabled ( ) ) { Logger . getLogger ( CachingCallbackFilter . class . getName ( ) ) . finer ( "call " + removedCallbacks . size ( ) + " more queued callbacks for " + ck ) ; } // and all the others, found in cache for ( RequestCallback cb : removedCallbacks ) { cb . onError ( request , exception ) ; } } } ; } else { if ( GWT . isClient ( ) && LogConfiguration . loggingIsEnabled ( ) ) { Logger . getLogger ( CachingCallbackFilter . class . getName ( ) ) . finer ( "removed one or no " + "callback for cachekey " + ck ) ; } } if ( isCachingStatusCode ( code ) ) { cacheResult ( method , response ) ; return callback ; } if ( GWT . isClient ( ) && LogConfiguration . loggingIsEnabled ( ) ) { Logger . getLogger ( CachingCallbackFilter . class . getName ( ) ) . info ( "cannot cache due to invalid response code: " + code ) ; } return callback ; }
the real filter method called independent of the response code