In my valve I get the execution time of my http query like that :
public void invoke(Request request, Response response)
throws IOException, ServletException {
long t1 = System.currentTimeMillis();
getNext().invoke(request, response);
long t2 = System.currentTimeMillis();
long time = t2 - t1;
...
}
I suspect that the time I get this way, not only give me the server side execution time but also the network time ? Is it possible ?
(Because depending on the client who do the request the average time measured is not the same from one ip I have 70ms average time and another ip 270ms)
I have written the exact same code in a Filter:
long before = System.currentTimeMillis();
chain.doFilter(request, response);
long after = System.currentTimeMillis();
, but in my test the execution time in the Valve and in the filter are the same...
I am more interested in getting the execution time of my servlet only. But if I could get also the time when the last byte is sent, I would be interested.
Thanks a lot to clarify me what is possible to know with valves and filters.