Getting hold of the servlet context within a filter

How can I get hold of the servlet context from within a filter?

[70 byte] By [bubblenut2a] at [2007-11-27 11:06:39]
# 1

By FilterConfig#getServletContext().

BalusCa at 2007-7-29 13:16:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

The Filter has a FilterConfig that contains the ServletContext.

class myFilter implements Filter {

private FilterConfig config;

public void init(FilterConfig filterConfig)

throws ServletException {

this.config = FilterConfig;

}

public void doFilter(ServletRequest request,

ServletResponse response,

FilterChain chain)

throws java.io.IOException,

ServletException {

ServletContext context = this.config.getServletContext();

}

}

tolmanka at 2007-7-29 13:16:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...