tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtallen <gtal...@home.com>
Subject Re: Q:How to auto-execute a function everytime a servlet is invoked.
Date Thu, 27 Apr 2000 01:44:58 GMT
Hi,
For JSP you could use the "extends" directive but it would be
far easier to use a bean or just include another JSP page
at runtime that does the update.

<jsp:include page="update.jsp" flush="true"/>
which will include it at runtime?

Greg

Rishi N wrote:
> 
> hi,
> 
> i tried overwriting just the service method. so my service method runs my
> function, and then i just call super.service(req,res), to invoke the
> HttpServlet version of service.this seems to work fine. i think i don't need
> to overwrite any of the other methods. is this correct? please advise.
> 
> i also have another problem now. the above trick will work for servlets, but
> how can i handle jsp's? i have no control over how the corresponding
> servlets are generated, so i cannot make them extend my class. of course, i
> could probably modify the tomcat code to make sure they use my servlet, but
> that seems to be a very dirty hack. is there any other way of doing this?
> 
> thanks,
> risi
> 
> >From: M Butcher <mbutcher1@uswest.net>
> >Reply-To: tomcat-user@jakarta.apache.org
> >To: tomcat-user@jakarta.apache.org
> >Subject: Re: Q:How to auto-execute a function everytime a servlet is
> >invoked.
> >Date: Wed, 26 Apr 2000 14:43:37 -0600
> >MIME-Version: 1.0
> >Received: from [63.211.145.10] by hotmail.com (3.2) with ESMTP id
> >MHotMailBAD09FCF00B4D820F3AA3FD3910A08AF0; Wed Apr 26 13:43:08 2000
> >Received: (qmail 49662 invoked by uid 500); 26 Apr 2000 20:42:41 -0000
> >Received: (qmail 49618 invoked from network); 26 Apr 2000 20:42:40 -0000
> >Received: from dnvrpop1.dnvr.uswest.net (206.196.128.3)  by
> >locus.apache.org with SMTP; 26 Apr 2000 20:42:40 -0000
> >Received: (qmail 29682 invoked by alias); 26 Apr 2000 20:37:26 -0000
> >Received: (qmail 28495 invoked by uid 0); 26 Apr 2000 20:37:01 -0000
> >Received: from unknown (HELO uswest.net) (63.224.69.43)  by
> >dnvrpop1.dnvr.uswest.net with SMTP; 26 Apr 2000 20:37:00 -0000
> >From tomcat-user-return-1818-reache Wed Apr 26 13:45:30 2000
> >Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm
> >Precedence: bulk
> >X-No-Archive: yes
> >list-help: <mailto:tomcat-user-help@jakarta.apache.org>
> >list-unsubscribe: <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> >list-post: <mailto:tomcat-user@jakarta.apache.org>
> >Delivered-To: mailing list tomcat-user@jakarta.apache.org
> >Delivered-To: fixup-tomcat-user@jakarta.apache.org@fixme
> >Message-ID: <390754F9.B5CFAB1E@uswest.net>
> >X-Mailer: Mozilla 4.61 [en] (Win98; I)
> >X-Accept-Language: en
> >References: <20000426201635.51768.qmail@hotmail.com>
> >X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N
> >
> >I'm assuming that when you say "when it is invoked", you mean when the
> >service
> >is requested.
> >
> >I suppose there are all kinds of ways to do this, one of which would be
> >overriding the service() method, and then reimplementing all of the http
> >specific methods (head, get, post, etc...)
> >
> >If you didn't want to re-implement, you could just override each service
> >method
> >(doGet, doPost, etc) to call your method and then invoke the superclasses
> >method.
> >
> >Rishi N wrote:
> >
> > > Hi,
> > >
> > > i'm trying to get a servlet to execute a certain function(which does
> >some
> > > book-keeping kind of tasks) everytime it is invoked. I'd like this to be
> > > done automatically, i.e., without having to explicitly call this method.
> >i
> > > was hoping to put this call in the init() method, but have subsequently
> > > found out that init() is only called once, when the servlet is first
> >loaded.
> > > I'm now thinking of creating a new class, as a subclass of
> >HttpServlet(say
> > > MyHttpServlet), and in this class, i could probably make this function
> >call.
> > > I realise that anyone who wishes to take advantage of this function will
> > > need to use MyHttpServlet(rather than HttpServlet) to implement his
> >class,
> > > but in our current application, that is feasible. the problem is where
> >do i
> > > put this call in MyHttpServlet, such that it is always executed
> > > automatically? i do not want the servlet implementer to know that this
> > > function is being called. is there any way to do this at all? are there
> >any
> > > better ways of achieving this result?
> > >
> > > many thanks,
> > > rishi
> > >
> > > ________________________________________________________________________
> > > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> > >
> > >
> >--------------------------------------------------------------------------
> > > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commmands, email: tomcat-user-help@jakarta.apache.org
> >
> >
> >--------------------------------------------------------------------------
> >To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commmands, email: tomcat-user-help@jakarta.apache.org
> >
> 
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message