You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by James Liang <jl...@andera.com> on 2013/11/27 09:23:53 UTC

sample code for beanshell preprocessor to rewrite url

Hi All,

I need to use the beanshell preprocess to modify the url of a http sampler.  Any coding samples that modifies the query string of a HTTP GET?  I need to figure out which jmeter object to change and how to change it.


Thanks,
James Liang


Re: sample code for beanshell preprocessor to rewrite url

Posted by Nicola Ambrosetti Brolin <am...@gmail.com>.
The simplest way I see is to use a variable for the path in the HTTP
Request sampler (e.g. ${httpRequestPath}) and then use a beanshell
preprocessor to set that variable as wished (code:
vars.put("httpRequestPath", "my/new/path")). They query string can be
completely specified in the path variable and there should be no need to
have additional variables for request parameters.

Nicola


On 27 November 2013 09:23, James Liang <jl...@andera.com> wrote:

> Hi All,
>
> I need to use the beanshell preprocess to modify the url of a http
> sampler.  Any coding samples that modifies the query string of a HTTP GET?
>  I need to figure out which jmeter object to change and how to change it.
>
>
> Thanks,
> James Liang
>
>