tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Lambert" <>
Subject byte trafic accounting
Date Tue, 16 Oct 2007 21:45:48 GMT
Our application serves request for mobile device (cellular phone). We
need to find a way to keep track of how many byte were read from the
request and sent in the response. We need to whole size of the
request/response not just the "Content-Length" (GET /TestValve/apps
HTTP/1.1 ... headers, everything). I was planning to go for a Valve but
it doesn't work:

    public void invoke(Request request, Response response) throws
IOException, ServletException {
        getNext().invoke(request, response);
        String localAddr = request.getLocalAddr();
        int bytesRead = request.getCoyoteRequest().getBytesRead();
        long bytesSent = response.getCoyoteResponse().getBytesWritten();
        System.out.println("request from: " + localAddr + ", recv=" +
bytesRead + ", sent=" + bytesSent);

bytesRead and bytesSent are always 0.

What's wrong? How can I do it?

We're are currently using Tomcat 5.5.25.


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message