restygwt/src/main/java/org/fusesource/restygwt/client/dispatcher/CachingDispatcherFilter.java
@Override
    public boolean filter(Method method, final RequestBuilder builder) {
        CacheKey cacheKey = cacheKey(builder);

        if (cacheKey != null) {
            final Response cachedResponse = cacheStorage.getResultOrReturnNull(cacheKey);
            if (cachedResponse != null) {
                //case 1: we got a result in cache => return it...
                if (LogConfiguration.loggingIsEnabled()) {
                    Logger.getLogger(Dispatcher.class.getName())
                        .info("already got a cached response for: " + builder.getHTTPMethod() + " " + builder.getUrl());
                }
                // onResponseReceived can be time consuming and can manipulate the DOM
                // deferring the command keeps the async behaviour of this method call
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                    @Override
                    public void execute() {
                        builder.getCallback().onResponseReceived(null, cachedResponse);
                    }
                });
                return false;
            }
            RequestCallback callback = callbackFactory.createCallback(method);

            //case 2: => no cache in result => queue it....
            if (!cacheStorage.hasCallback(cacheKey)) {
                //case 2.1 => first callback => make a new one and execute...
                cacheStorage.addCallback(cacheKey, builder.getCallback());

                if (LogConfiguration.loggingIsEnabled()) {
                    Logger.getLogger(Dispatcher.class.getName())
                        .info("Sending *caching* http request: " + builder.getHTTPMethod() + " " + builder.getUrl());
                }

                // important part:
                builder.setCallback(callback);
                return true;
            }
            //case 2.2 => a callback already in progress => queue to get response when back
            if (LogConfiguration.loggingIsEnabled()) {
                Logger.getLogger(Dispatcher.class.getName())
                    .info("request in progress, queue callback: " + builder.getHTTPMethod() + " " + builder.getUrl());
            }
            cacheStorage.addCallback(cacheKey, callback);
            return false;
        }
        // non cachable case
        if (LogConfiguration.loggingIsEnabled()) {
            String content = builder.getRequestData();
            Logger.getLogger(Dispatcher.class.getName()).info(
                "Sending *non-caching* http request: " + builder.getHTTPMethod() + " " + builder.getUrl() +
                    " (Content: `" + content + "´)");
        }

        //            /*
        //             * add X-Request-Token to all non-caching calls (!= GET) if we have some
        //             */
        //            builder.setHeader("X-Testing", "Bude");

        builder.setCallback(callbackFactory.createCallback(method));
        return true;// continue filtering
    }
@Override
    public boolean filter(Method method, final RequestBuilder builder) {
        CacheKey cacheKey = cacheKey(builder);

        if (cacheKey != null) {
            final Response cachedResponse = cacheStorage.getResultOrReturnNull(cacheKey);
            if (cachedResponse != null) {
                //case 1: we got a result in cache => return it...
                if (LogConfiguration.loggingIsEnabled()) {
                    Logger.getLogger(Dispatcher.class.getName())
                        .info("already got a cached response for: " + builder.getHTTPMethod() + " " + builder.getUrl());
                }
                // onResponseReceived can be time consuming and can manipulate the DOM
                // deferring the command keeps the async behaviour of this method call
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                    @Override
                    public void execute() {
                        builder.getCallback().onResponseReceived(null, cachedResponse);
                    }
                });
                return false;
            }
            RequestCallback callback = callbackFactory.createCallback(method);

            //case 2: => no cache in result => queue it....
            if (!cacheStorage.hasCallback(cacheKey)) {
                //case 2.1 => first callback => make a new one and execute...
                cacheStorage.addCallback(cacheKey, builder.getCallback());

                if (LogConfiguration.loggingIsEnabled()) {
                    Logger.getLogger(Dispatcher.class.getName())
                        .info("Sending *caching* http request: " + builder.getHTTPMethod() + " " + builder.getUrl());
                }

                // important part:
                builder.setCallback(callback);
                return true;
            }
            //case 2.2 => a callback already in progress => queue to get response when back
            if (LogConfiguration.loggingIsEnabled()) {
                Logger.getLogger(Dispatcher.class.getName())
                    .info("request in progress, queue callback: " + builder.getHTTPMethod() + " " + builder.getUrl());
            }
            cacheStorage.addCallback(cacheKey, callback);
            return false;
        }
        // non cachable case
        if (LogConfiguration.loggingIsEnabled()) {
            String content = builder.getRequestData();
            Logger.getLogger(Dispatcher.class.getName()).info(
                "Sending *non-caching* http request: " + builder.getHTTPMethod() + " " + builder.getUrl() +
                    " (Content: `" + content + "´)");
        }

        //            /*
        //             * add X-Request-Token to all non-caching calls (!= GET) if we have some
        //             */
        //            builder.setHeader("X-Testing", "Bude");

        builder.setCallback(callbackFactory.createCallback(method));
        return true;// continue filtering
    }
main filter method for a dispatcherfilter.

@return continue filtering or not