robe-servlet/src/main/java/io/robe/servlet/WrapperServlet.java
private final void dispatch(Method call, UnitOfWork uow, HttpServletRequest req, HttpServletResponse resp) {
        if (uow == null) {
            try {
                ResourceServlet servlet = GuiceBundle.getInjector().getInstance(servletClass);
                call.invoke(servlet, req, resp);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            SessionFactory sessionFactory = GuiceBundle.getInjector().getInstance(SessionFactory.class);
            Session session = sessionFactory.openSession();
            try {
                configureSession(session, uow);
                ManagedSessionContext.bind(session);
                beginTransaction(session, uow);
                try {
                    ResourceServlet servlet = (singleton == null) ? singleton : GuiceBundle.getInjector().getInstance(servletClass);
                    call.invoke(servlet, req, resp);
                    commitTransaction(session, uow);
                } catch (Exception e) {
                    rollbackTransaction(session, uow);
                    throw new RuntimeException(e);
                }
            } finally {
                session.close();
                ManagedSessionContext.unbind(sessionFactory);
            }
        }
    }
private final void dispatch(Method call, UnitOfWork uow, HttpServletRequest req, HttpServletResponse resp) {
        if (uow == null) {
            try {
                ResourceServlet servlet = GuiceBundle.getInjector().getInstance(servletClass);
                call.invoke(servlet, req, resp);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            SessionFactory sessionFactory = GuiceBundle.getInjector().getInstance(SessionFactory.class);
            Session session = sessionFactory.openSession();
            try {
                configureSession(session, uow);
                ManagedSessionContext.bind(session);
                beginTransaction(session, uow);
                try {
                    ResourceServlet servlet = (singleton == null) ? singleton : GuiceBundle.getInjector().getInstance(servletClass);
                    call.invoke(servlet, req, resp);
                    commitTransaction(session, uow);
                } catch (Exception e) {
                    rollbackTransaction(session, uow);
                    throw new RuntimeException(e);
                }
            } finally {
                session.close();
                ManagedSessionContext.unbind(sessionFactory);
            }
        }
    }
private final void dispatch ( Method call , UnitOfWork uow , HttpServletRequest req , HttpServletResponse resp ) { if ( uow == null ) { try { ResourceServlet servlet = GuiceBundle . getInjector ( ) . getInstance ( servletClass ) ; call . invoke ( servlet , req , resp ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } else { SessionFactory sessionFactory = GuiceBundle . getInjector ( ) . getInstance ( SessionFactory . class ) ; Session session = sessionFactory . openSession ( ) ; try { configureSession ( session , uow ) ; ManagedSessionContext . bind ( session ) ; beginTransaction ( session , uow ) ; try { ResourceServlet servlet = ( singleton == null ) ? singleton : GuiceBundle . getInjector ( ) . getInstance ( servletClass ) ; call . invoke ( servlet , req , resp ) ; commitTransaction ( session , uow ) ; } catch ( Exception e ) { rollbackTransaction ( session , uow ) ; throw new RuntimeException ( e ) ; } } finally { session . close ( ) ; ManagedSessionContext . unbind ( sessionFactory ) ; } } }
Executes the desired method call with a new instance of the {@link ResourceServlet} implementation.
Transaction management is done here.

@param call
@param uow
@param req
@param resp
Executes the desired method call with a new instance of the { @link ResourceServlet } implementation . Transaction management is done here .