TransactionFilter

From Resin 3.0

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