tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helena Carbajo <helenacarbajoolm...@gmail.com>
Subject Re: Get startTime of coyoteRequest object from RequestFacade
Date Tue, 05 Mar 2019 14:29:53 GMT
 >I can think of a couple of other ways of doing this but what problem are
>you trying to solve?

I need it in order to calculate the time requests spend in the queue since
the arrive at the server until a thread process them. I haven't seen any
other parameter to make this calculation.

Helena

El mar., 5 mar. 2019 a las 15:25, Mark Thomas (<markt@apache.org>) escribió:

> I can think of a couple of other ways of doing this but what problem are
> you trying to solve?
>
> Mark
>
>
> On 05/03/2019 13:35, Helena Carbajo wrote:
> > Hi!
> > I'd like to get the startTime field of a request. The problem is that
> what
> > I get is a RequestFacade, which has the
> > org.apache.catalina.connector.Request object that holds the
> > org.apache.coyote.Request object. Yet, the catalina.connector.Request is
> a
> > protected field, and doesn't have a getter method either. I also tried to
> > create subclass from RequestFacade but still need the
> > org.apache.catalina.connector.Request for the constractor. So far, the
> only
> > solution I've found is using reflection:
> >
> >         f = request.getClass().getDeclaredField("request");
> >         f.setAccessible(true);
> >         realRequest = (org.apache.catalina.connector.Request)
> > f.get(request);
> >         this.coyote_request = realRequest.getCoyoteRequest();
> >         return this.coyote_request.getStartTime();
> >
> > However, I don't think this is a good practice, so is there any way to
> get
> > this field or to expose it?
> > Thank you!
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message