Hi Subir,

I had the following interceptor class for Tomcat 3.2.2

public class CountRequest extends BaseInterceptor
{


        static int noOfRequests=0;
    public CountRequest()
    {
        super();
    }


   public int preService(Request request, Response response) {
        try{
                        HttpServletRequest req =request.getFacade();

                        if 
(request.getServletPath().equalsIgnoreCase("/servlet/Read")){
                                noOfRequests++;
                                System.out.println("/servlet/Read "+noOfRequests);

                        }

                        if 
(request.getServletPath().equalsIgnoreCase("/servlet/LoadTest")) {
                                Integer load = new Integer(noOfRequests);
                                req.setAttribute("load",load.toString());
                                System.out.println("/servlet/LoadTest ="+noOfRequests);
                        }
           } catch (Exception e){System.out.println("Exception is Performance 
Interceptor");}
                return 0;
        }


    /*postService is invoked right after service() is invoked on the actual 
servlet*/
    public int postService(Request request, Response response) {

                if 
(request.getServletPath().equalsIgnoreCase("/examples/servlet/Read"))
                        noOfRequests--;
                return 0;
    }


}



I used to increment noOfRequests in preService and decrement it in 
postService. But, How do I do the same in Tomcat 4.0

Thanks
Venky












----Original Message Follows----
From: Subir Sengupta <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]>
To: 'Tomcat Users List' <[EMAIL PROTECTED]>
Subject: RE: Request Interceptor
Date: Wed, 24 Apr 2002 17:53:42 -0700

T4 doesn't have interceptors.  It sounds like you can do what you need to do
with a filter.

Hope that helps,
Subir

-----Original Message-----
From: Venkatesh Sangam [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 5:03 PM
To: [EMAIL PROTECTED]
Subject: Request Interceptor


Hi,
can any body please tell me where do put my request iterceptor in Tomcat 4
I could easily do this using Tomcat 3.2.2 in server.xml file.

I need to intercept request to measure the load in the tomcat server. ie I
need to count the number of requests at any point in time..

I already have written the progrom and the interceptor is working fine with
Tomcat 3.2.2.
But Can any body please tell me how do I do the same using Tomcat 4.0.3

<RequestInterceptor class="CountRequests" />


Thanks
Venky


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




.......Phir Bhi Dil Hai Hindustani

Venkatesh Sangam,
1207, E 8th Street,
Apt #114,
Tempe, AZ, 85281
Ph:480-736-9392


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to