com.caucho.filters
Class TransactionFilter

java.lang.Object
  extended by com.caucho.filters.TransactionFilter
All Implemented Interfaces:
Filter

public class TransactionFilter
extends java.lang.Object
implements Filter

Wraps the request in a transaction. All database calls for the request will either succeed together or fail.

Since:
Resin 2.0.5

Constructor Summary
TransactionFilter()
           
 
Method Summary
 void destroy()
          Any cleanup for the filter.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain nextFilter)
          Wrap the request in a transaction.
 void init(FilterConfig config)
          Lookup java:comp/UserTransaction and cache the results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionFilter

public TransactionFilter()
Method Detail

init

public void init(FilterConfig config)
          throws ServletException
Lookup java:comp/UserTransaction and cache the results.

Specified by:
init in interface Filter
Throws:
ServletException

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain nextFilter)
              throws ServletException,
                     java.io.IOException
Wrap the request in a transaction. If the request returns normally, the transaction will commit. If an exception is thrown it will rollback.

Specified by:
doFilter in interface Filter
Parameters:
request - the servlet request
response - the servlet response
nextFilter - the next filter in the chain
Throws:
ServletException
java.io.IOException

destroy

public void destroy()
Any cleanup for the filter.

Specified by:
destroy in interface Filter