class ServletContextImpl implements ServletContext {

    public void handleSession(final HttpSessionImpl session, final HttpServletResponseImpl response) throws IOException {
        Cookie cookie = new Cookie(HttpSessionImpl.COOKIE_NAME, "");
        if (session.isInvalidated()) {
            cookie.setMaxAge(MAX_AGE_IN_PAST);

            sessionStorage.removeSession(session);
            LOGGER.log(Level.FINE, "Invalidated session {0}",
                    new Object[]{session.getId()});
        } else {
            cookie.setValue(session.getId());
            sessionStorage.persistSession(session);
        }

        response.addCookie(cookie);
    }

    public  ServletContextImpl(final String contextPath,
                              final List<ServletMapping> servletMappings,
                              final List<FilterMapping> filterMappings,
                              final Map<String, Object> attributes,
                              final ServerConfig serverConfig,
                              final SessionStorage sessionStorage);

}