1 13 package info.magnolia.cms.filters; 14 15 import info.magnolia.context.MgnlContext; 16 17 import java.io.IOException ; 18 19 import javax.servlet.Filter ; 20 import javax.servlet.FilterChain ; 21 import javax.servlet.FilterConfig ; 22 import javax.servlet.ServletException ; 23 import javax.servlet.ServletRequest ; 24 import javax.servlet.ServletResponse ; 25 import javax.servlet.http.HttpServletRequest ; 26 27 28 33 public class MgnlContextFilter implements Filter { 34 35 public void init(FilterConfig conf) throws ServletException { 36 } 37 38 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException , 39 ServletException { 40 41 if (!MgnlContext.hasInstance()) { 42 MgnlContext.initAsWebContext((HttpServletRequest ) request); 43 } 44 45 chain.doFilter(request, response); 46 47 MgnlContext.setInstance(null); 48 } 49 50 public void destroy() { 51 } 52 } 53 | Popular Tags |