TransactionFilter

From Resin 3.0

Revision as of 03:43, 1 December 2005 by Ferg (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


com.caucho.filters.TransactionFilter wraps the request in a transaction. If the request completes normally, the transaction will commit, otherwise it will rollback.

TransactionFilter pseudo-code

try {
  userTransaction.begin();

  nextFilter.doFilter(request, response);

  userTransaction.commit();
} catch (Exception e) {
  userTransaction.rollback();

  throw e;
}

The configuration in the resin-web.xml (or web.xml) is as follows:

resin-web.xml

<filter filter-name="transaction"
        filter-class="com.caucho.filters.TransactionFilter"/>

<filter-mapping url-pattern="/transaction/*" filter-name="transaction"/>
Personal tools