/** * Intercept the Container request to add length of request and a start timestamp. * * @param request Request to intercept * * @throws IOException if there's a problem processing the request */ @Override public void filter(ContainerRequestContext request) throws IOException { appendRequestId(request.getHeaders().getFirst(X_REQUEST_ID_HEADER)); RequestLog.startTiming(TOTAL_TIMER); try (TimedPhase timer = RequestLog.startTiming(this)) { RequestLog.record(new Preface(request)); // sets PROPERTY_REQ_LEN if content-length not defined lengthOfRequestEntity(request); // store start time to later calculate elapsed time request.setProperty(PROPERTY_NANOS, System.nanoTime()); } }