What I want to do is get the timestamp in milliseconds (epoch) for my request when it lands in the interceptor. I have a HttpServletRequest request variable. I thought of invoking request.getDateHeader() but it asks for the name of the header and I'm not sure how to retrieve that from the request.
There's just so much fuzz in there. Any network request is actually smeared out over time. The time the client opened the request connection, the time when the last byte of the request left the client (and note that that client's clock may be wrong!), the time it got queued up in the server, time to digest it into actual JEE component objects, the time it actually gets dispatched (which can be delayed if the processing thread pool is backed up.
Also, HTTP itself carries no timestamp, so you're going to have to measure from outside.
In most cases, I consider it sufficient to grab the time of day in the beginning of the servlet request execution method (e.g., doGet()). If the request initiates persistent data storage operations, I let the database worry about the actual time that the transaction was committed. And, of course, if the point is to see how fast a request can be processed, I'll take a time snapshot right before I exit the servlet request method.
Don't forget - if you're using a logger, the logger itself usually timestampts log entries.
An IDE is no substitute for an Intelligent Developer.
You don't like waffles? Well, do you like this tiny ad?