1 package org.roller.presentation.filters; 2 3 import java.io.IOException ; 4 5 import javax.servlet.Filter ; 6 import javax.servlet.FilterChain ; 7 import javax.servlet.FilterConfig ; 8 import javax.servlet.ServletException ; 9 import javax.servlet.ServletRequest ; 10 import javax.servlet.ServletResponse ; 11 import javax.servlet.http.HttpServletRequest ; 12 import javax.servlet.http.HttpServletResponse ; 13 14 import org.apache.commons.logging.Log; 15 import org.apache.commons.logging.LogFactory; 16 import org.roller.RollerException; 17 import org.roller.model.Roller; 18 import org.roller.presentation.RollerContext; 19 20 26 public class PersistenceSessionFilter implements Filter 27 { 28 private static Log mLogger = 29 LogFactory.getFactory().getInstance(RequestFilter.class); 30 31 34 public void destroy() 35 { 36 } 37 38 41 public void doFilter( 42 ServletRequest req, ServletResponse res, FilterChain chain) 43 throws IOException , ServletException 44 { 45 HttpServletRequest request = (HttpServletRequest )req; 46 HttpServletResponse response = (HttpServletResponse )res; 47 if (mLogger.isDebugEnabled()) 48 { 49 mLogger.debug("Entered PersistenceSessionFilter"); 50 } 51 Roller roller = RollerContext.getRoller((HttpServletRequest )request); 52 try 53 { 54 chain.doFilter(request, response); 55 } 56 finally 57 { 58 roller.release(); 59 } 60 if (mLogger.isDebugEnabled()) 61 { 62 mLogger.debug("Exiting PersistenceSessionFilter"); 63 } 64 } 65 66 69 public void init(FilterConfig filterConfig) throws ServletException 70 { 71 } 72 } 73 74 | Popular Tags |