>using a BeanShell PRE processor, and not a POST?
sorry , yes that should be a pre processor. One of the objects available to
pre processor is the sampler object (a java object whose javadoc wa
provided in the previous mail.)
I cannot test or provide a working snippet till later - heres pseudo code
import org.apache.jmeter.protocol.http.control.Cookie;

*Cookie cookie = new Cookie(*"name of your cookie"
<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html>,
       vars.get("RegexVariableNameThatyouextractedto"),
       "domainforcookie"
<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html>,
       "pathforcookie"
<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html>,
       false,
       reallylargelongvalueforexpiry*);
*

sampler.getCookieManager().add(cookie);

You probbaly got bean shell errors that should be logged in jmeter.log - so
check that if something fails

regards
deepak

On Wed, Apr 18, 2012 at 1:34 PM, <[email protected]> wrote:

> Deepak Shetty <[email protected]> wrote on 04/18/2012 01:49:16 PM:
> >
> > Extracting the cookie is a regex extractor (where you select the option
> for
> > Header) and extract based on the name or 'Set-Cookie' header
> > Then you add a beanshell post processor that does something like
> > sampler.getCookieManager().addCookie(cookie); where the cookie is based
> on
> > the value you extracted
>
> I seem to be doing something wrong. I am able to extract the section of the
> cookie I need, in the format I need.
>
> However,  the cookie is not showing up as I need/want it to.
>
> In the example given is "sampler" the literal text I would use, or is it a
> placeholder for the actual sampler or some other sort of reference to the
> sampler  the processor is attached to?
>
> Also, I am needing to modify the cookies being SENT, so shouldn't I be
> using a BeanShell PRE processor, and not a POST?
>
> Reference Name       : GROUP_COOKIE
> Regular Expression : tn_cookie_groups=("[A-Za-z0-9\ _-]*")
> Template                     : $1$
>
> Script:
>
> sampler.getCookieManager().addCookie(Cookie("tn_cookie_groups2",  $
> {GROUP_COOKIE}));
>
> I have also tried:
>
> sampler.getCookieManager().addCookie("tn_cookie_groups2",  $
> {GROUP_COOKIE});
>
> in both pre and post processors.
>
> Please forgive me if this is something obvious or basic, but I am
> relatively new to jmeter and have been fighting with this issue for
> approaching two weeks now.
>
> Thank you for your help.
>
> Lee Lowder
>
> This communication and any attachments are confidential, protected by
> Communications Privacy Act 18 USCS ยง 2510, solely for the use of the
> intended recipient, and may contain legally privileged material. If you are
> not the intended recipient, please return or destroy it immediately. Thank
> you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to