Hi,
I use a dispatcher to log page access, I need to use sessionManager to commit otherwise the log will not be saved to the mysql, however, the commit sometimes produce undesirable effects to the page, is there a way to maintain a separate sessionManager in addition to the default SessionManager? or any easier way to maintain a log in the mysql? thanks.
Angelo
public class LoggingDispatcher implements Dispatcher {
private final HibernateSessionManager sessionManager;
public LoggingDispatcher(HibernateSessionManager sessionManager) {
this.sessionManager = sessionManager;
}
public boolean dispatch(Request request, Response response) throws IOException {
PageLog log = new PageLog();
log.setPath(request.getPath());
sessionManager.getSession().save(log);
sessionManager.commit();
return false;
}
}