On 22/04/07, chris <[EMAIL PROTECTED]> wrote:
hi!

i want to set cookie data (like session id) manually, with a preprocessor.
for the httpsampleresult, i found the method prev.setCookies(...).

"prev" is the previous sample result, so setting the cookies for this
does not affect the next sample.

if i call this method, i see the cookie data in my "view results tree" at
the request tab, but at the "sampler result" tab another jsession id is set
("Set-Cookie: ...").

what do i make wrong?

See above.

is this possible at all?

Cookies are handled by the Cookie Manager (CM). When a Cookie is
received by the sampler, it is stored in the CM. When the next sampler
runs, it calls on the CM to provide the appropriate cookies.

So you would need to add the new cookie to the CM.

You should be able to use the following code to get the CM:

cm=sampler.getCookieManager()

[You might need to cast sampler to HTTPSamplerBase first]

You should then be able to use the appropriate CM method to add the
cookie; either

cm.add(Cookie cookie)
or
cm.addCookieFromHeader(String cookieHeader, URL url)

You could perhaps get the URL using sampler.getUrl().

I've not tried any of this.

You'll need to have either the JMeter source or Javadoc API handy.

S///

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to