public static void compareContextState()

in zuul-core/src/main/java/com/netflix/zuul/context/Debug.java [117:146]


    public static void compareContextState(String filterName, SessionContext context, SessionContext copy) {
        // TODO - only comparing Attributes. Need to compare the messages too.

        // Ensure that the routingDebug property already exists, otherwise we'll have a ConcurrentModificationException
        // below
        getRoutingDebug(context);

        Iterator<String> it = context.keySet().iterator();
        String key = it.next();
        while (key != null) {
            if ((!key.equals("routingDebug") && !key.equals("requestDebug"))) {
                Object newValue = context.get(key);
                Object oldValue = copy.get(key);
                if (!(newValue instanceof ReferenceCounted) && !(oldValue instanceof ReferenceCounted)) {
                    if (oldValue == null && newValue != null) {
                        addRoutingDebug(context, "{" + filterName + "} added " + key + "=" + newValue.toString());
                    } else if (oldValue != null && newValue != null) {
                        if (!oldValue.equals(newValue)) {
                            addRoutingDebug(context, "{" + filterName + "} changed " + key + "=" + newValue.toString());
                        }
                    }
                }
            }
            if (it.hasNext()) {
                key = it.next();
            } else {
                key = null;
            }
        }
    }