@Override
  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) servletRequest;
    HttpServletResponse response = (HttpServletResponse) servletResponse;

    DBSessions dbSessions = platform.getContainer().getComponentByType(DBSessions.class);
    ThreadLocalSettings settings = platform.getContainer().getComponentByType(ThreadLocalSettings.class);
    UserSessionInitializer userSessionInitializer = platform.getContainer().getOptionalComponentByType(UserSessionInitializer.class).orElse(null);

    LOG.trace("{} serves {}", Thread.currentThread(), request.getRequestURI());
    dbSessions.enableCaching();
    try {
      settings.load();
      try {
        doFilter(request, response, chain, userSessionInitializer);
      } finally {
        settings.unload();
      }
    } finally {
      dbSessions.disableCaching();
    }
  }
@Test
  public void doFilter_enables_and_disables_caching_in_DbSessions() throws Exception {
    underTest.doFilter(request, response, chain);

    InOrder inOrder = inOrder(dbSessions);
    inOrder.verify(dbSessions).enableCaching();
    inOrder.verify(dbSessions).disableCaching();
    inOrder.verifyNoMoreInteractions();
  }