private boolean alreadyWrapped(final ServletRequest request) {
    if (request instanceof RequestWrapper) {
      return true;
    }

    if (!(request instanceof ServletRequestWrapper)) {
      return false;
    }

    final ServletRequest nestedRequest = ((ServletRequestWrapper) request).getRequest();

    if (nestedRequest == request) {
      return false;
    }

    return alreadyWrapped(nestedRequest);
  }
Test if a request has been wrapped with RequestWrapper somewhere in the chain of wrapped
requests.
extensions/geode-modules-session/src/main/java/org/apache/geode/modules/session/filter/SessionCachingFilter.java