Guys, I've been following this thread for a while now, but doesn't
Jmeter already do what you're trying to accomplish here?

I've used jmeter's proxy to record and replay http requests/responses
before with success.

Or am I missing something here?

Here's a link to some instructions :
http://jakarta.apache.org/jmeter/usermanual/jmeter_proxy_step_by_step.pd
f

Rgds,

T

-----Original Message-----
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: vrijdag 20 februari 2009 17:07
To: Tomcat Users List
Subject: Re: Record and simulate a web app


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Youssef,

On 2/20/2009 10:45 AM, Youssef Mohammed wrote:
> Yeah I was thinking that the capture code would perfectly fit in some
HTTP
> tunnel so that we can capture the whole thing coming out of the web
server ,
> what do you think ?

Okay, I took a stack trace of my servlet's code right in the middle of
the request (TC 5.5.26) and found this at the top (it's really my first
delve into exactly what code gets executed before application code, so
forgive me if you already knew this):

...blah...blah...blah...
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:215)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:174)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:117)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:108)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
74)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:87
4)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:665)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:528)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:81)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:689)


The "blah blah blah" part is all application code from there on up.
ApplicationFilterChain.internalDoFilter calls the configured filters in
order, starting with mine (which I of course configured first).

Note that I'm looking at the source for Tomcat 6.0.16 yet running
5.5.26. Stupid, I know, but the architecture hasn't changed /that/ much.

I started at the /bottom/, ignoring the socket stuff, and right there in
Http11Processor.prepareResponse I find this:

        headers.setValue("Date").setString(date);

So, Tomcat post-processes the HTTP headers at the Connector level.
Without writing your own /Connector/, you aren't going to be able to
intercept the response properly. I was hoping to get away with a valve.

I suppose you could subclass, say, Http11Processor and, in your
constructor, replace the outputBuffer class with a wrapper for
InternalOutputBuffer.

But this is getting a little messy for me. Since I don't need it, I'm
not too concerned about getting it done. :(

If you figure out a way to capture the response, and determine how how
to uniquely identify requests to match the response you want to return,
I can show you how to write a servlet that can re-play the
previously-saved responses.

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkme1R0ACgkQ9CaO5/Lv0PByBwCfay9gRGEJ/R8m5H+iGB3s0lLP
vP8An122DIn2SreN7czoa1+4HMaWeNPZ
=anEz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to