Called by the web container to indicate to a filter that it is being
placed into service. The servlet container calls the init method exactly
once after instantiating the filter. The init method must complete
successfully before the filter is asked to do any filtering work.

The doFilter method of the Filter is called by the
container each time a request/response pair is passed through the
chain due to a client request for a resource at the end of the chain.
The FilterChain passed in to this method allows the Filter to pass on
the request and response to the next entity in the chain.

Parameters:

srequest the runtime request

sresponse the runtime response

chain the filter chain to in the request processing

Throws:

java.io.IOException, ServletException
- First check if this HTTP method permits caching (using helper)
if not, call the downstream filter and return.
- Otherwise, get the key based on the request (using helper).
- Check if we have a response entry in the cache already.
- If there is entry and is valid, write out the response from that
entry.
- create a CachingResponse and CachingOutputStream wrappers and call
the downstream filter

clear the old entry?
may lead to NPEs with one thread that just replaced an entry
which might have just obtained before the new entry is put
in cache. Must implement some sort of ref count or leave it
to garbage collector
if (oldEntry != null)
oldEntry.clear();

Called by the web container to indicate to a filter that it is being
taken out of service. This method is only called once all threads
within the filter's doFilter method have exited or after a timeout
period has passed.
After the web container calls this method, it will not call the
doFilter method again on this instance of the filter.