@Override
  public void dispatch(Object resource, HttpContext context) {
    final TimerContext time = timer.time();

    try {
      wrappedDispatcher.dispatch(resource, context);
    } finally {
      time.stop();
    }
  }
 @Override
 public void dispatch(Object resource, HttpContext context) {
   final Session session = route(context).openSession();
   try {
     configureSession(session);
     ManagedSessionContext.bind(session);
     beginTransaction(session);
     try {
       dispatcher.dispatch(resource, context);
       commitTransaction(session);
     } catch (Exception e) {
       rollbackTransaction(session);
       this.<RuntimeException>rethrow(e);
     }
   } finally {
     session.close();
     ManagedSessionContext.unbind(route(context));
   }
 }