In my first Stripes application, I created a ServletFilter that
closes my Hibernate connection.
It added more verbiage to WEB-INF/web.xml . It seems like there's a
better way to do this. Isn't there some cleanup facility built into
Stripes? Am I missing something obvious, like why aren't you allowing
Hibernate to close itself?
I'm sure this is a common case. Wondering if Servlet filters are the
best practice.
public class SessionCloseFilter implements Filter
{
public final static String SESSION_ATTRIBUTE =
"com.thinknola.signup.Session";
public void init(FilterConfig filterConfig) throws ServletException
{
}
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
try
{
chain.doFilter(request, response);
}
finally
{
Session session = (Session) request.getAttribute
(SESSION_ATTRIBUTE);
if (session != null)
{
session.close();
}
}
}
public void destroy()
{
}
}
--
Alan Gutierrez | [EMAIL PROTECTED] | http://blogometer.com/ | 504
717 1428
Think New Orleans | http://thinknola.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users