src/main/java/org/efaps/ui/filter/TransactionFilter.java
@Override
    protected void doFilter(final HttpServletRequest _request,
                            final HttpServletResponse _response,
                            final FilterChain _chain)
        throws IOException, ServletException
    {
        try {
            Locale locale = null;

            locale = _request.getLocale();

            final Map<String, String[]> params = new HashMap<>(_request.getParameterMap());

            Context.begin(getLoggedInUser(_request), locale, getContextSessionAttributes(_request), params,
                            null, Context.Inheritance.Inheritable);
        } catch (final EFapsException e) {
            TransactionFilter.LOG.error("could not initialise the context", e);
            throw new ServletException(e);
        }

        try {
            boolean ok = false;
            try {
                _chain.doFilter(_request, _response);
                ok = true;
            } finally {

                if (ok && Context.isTMActive()) {
                    Context.commit();
                } else {
                    if (Context.isTMMarkedRollback()) {
                        TransactionFilter.LOG.error("transaction is marked to roll back");
                    } else {
                        TransactionFilter.LOG.error("transaction manager in undefined status");
                    }
                    Context.rollback();
                }
            }
        } catch (final EFapsException e) {
            TransactionFilter.LOG.error("", e);
            throw new ServletException(e);
        }
    }
@Override
    protected void doFilter(final HttpServletRequest _request,
                            final HttpServletResponse _response,
                            final FilterChain _chain)
        throws IOException, ServletException
    {
        try {
            Locale locale = null;

            locale = _request.getLocale();

            final Map<String, String[]> params = new HashMap<>(_request.getParameterMap());

            Context.begin(getLoggedInUser(_request), locale, getContextSessionAttributes(_request), params,
                            null, Context.Inheritance.Inheritable);
        } catch (final EFapsException e) {
            TransactionFilter.LOG.error("could not initialise the context", e);
            throw new ServletException(e);
        }

        try {
            boolean ok = false;
            try {
                _chain.doFilter(_request, _response);
                ok = true;
            } finally {

                if (ok && Context.isTMActive()) {
                    Context.commit();
                } else {
                    if (Context.isTMMarkedRollback()) {
                        TransactionFilter.LOG.error("transaction is marked to roll back");
                    } else {
                        TransactionFilter.LOG.error("transaction manager in undefined status");
                    }
                    Context.rollback();
                }
            }
        } catch (final EFapsException e) {
            TransactionFilter.LOG.error("", e);
            throw new ServletException(e);
        }
    }
@param _request servlet request
@param _response servlet response
@param _chain filter chain
@throws IOException on error
@throws ServletException on error