Hi Dave, On Fri, 2011-05-27 at 08:10 -0400, Dave Newton wrote:
> What specifically do you need an actual request for? This strikes me > as coupling your design to the servlet spec, and there's rarely a > strong reason to do that past the web layer itself. The idea on > injecting a request just seems wrong. > > Is that a Struts 2 interceptor you're trying to inject it in to? > It's an hibernate interceptor. It kicks in when you're committing the transaction to the database. This audit interceptor stores who changed what information. In very simple terms: date || user || property || old value || new value || ipaddress|| 2011-05-27 13:18 || dnewton || patient[22].age || 27 || 40 || 83.999.21.21|| This class is the one responsible for: a) detecting what changes are being made b) Detecting who made the changes c) log that info onto the database. This interceptor extends an org.hibernate.EmptyInterceptor (that kicks in with methods like onSave, onDelete, etc). I need the HttpServletRequest because it's the only way I've found to: a) retrieve the username (request.getUserPrincpal.getName) b) retrieve the user's IP address. Do you see any other better alternative and/or a solution to my previous mails' question? Thanks a lot for your quick reply! Miguel Almeida

