Thanks for the help,

This did the trick::

Header header = new Header("Cookie", cookie_with_session_id);

HeaderManager manager = sampler.getHeaderManager();

if(manager == null) {

} else {

manager.add(header);
}



On Dec 7, 2007 1:28 PM, sebb <[EMAIL PROTECTED]> wrote:

> In that case, you don't need access to the Header Manager, you can do
> it on the HTTP Sampler itself. And Pre-Processors have access to the
> samplers.
>
> Here's an example of setting arguments from the unit test
> PostWriterTest.setupFormData():
>
>        Arguments args = new Arguments();
>        HTTPArgument argument1 = new HTTPArgument("title", titleValue,
> isEncoded);
>        HTTPArgument argument2 = new HTTPArgument("description",
> descriptionValue, isEncoded);
>        args.addArgument(argument1);
>        args.addArgument(argument2);
>        httpSampler.setArguments(args);
>
> For further details, please consult the JavaDoc.
>
> However, if the number of parameters does not vary, then you'll
> probably find it easier to use variables. Even if the number does
> vary, you can probably get round this by setting the variable name to
> the empty string for missing parameters. e.g. set up variables
> N1,V2...N10,V10 and use ${N1} = ${V1} etc in the parameter list.
>
>
>
> On 07/12/2007, MATT CARBONE <[EMAIL PROTECTED]> wrote:
> > Basically I need to write a beanshell script that can set request
> headers.
> >
> > A simple example of doing this in a pre-processor would solve a whole
> host
> > of problems in our testing scenario.
> >
> > Thanks again for taking the time,
> > -Matt
> >
> >
> > On Dec 6, 2007 8:12 PM, sebb <[EMAIL PROTECTED]> wrote:
> >
> > > It's not going to be easy to find the Header Manager from BeanShell,
> > > but I don't think it's necessary.
> > >
> > > Why not just use variables in the header manager?
> > >
> > > The variables can easily be set using a BSH P-P - or any other method
> > > for that matter.
> > >
> > > Or indeed you could use the BSH function in the Header Manager.
> > >
> > > What are you trying to do?
> > >
> > > On 07/12/2007, MATT CARBONE <[EMAIL PROTECTED]> wrote:
> > > > Is it possible to parameterize a HTTP header?
> > > >
> > > > Ideally, I would like to be able to access the Header Manger via a
> > > beanshell
> > > > preprocessor script and have it set dynamically each time.
> > > >
> > > > Thanks in advance,
> > > > -Matt
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to