This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Dealing with escaped URLs

URLs that are present in HTML pages are usually encoded. For example:


If the URL is extracted using a Regular Expression Post-Processor and used directly in another HTTP Sampler, then the sample may well fail, as the server is expecting to see:


As of JMeter 2.3.1 there is no automatic way of handling this, however there are some work-rounds. Assume that the URL is stored in the variable ESCAPED_URL.

Using Jexl:

No Format

Using BeanShell:

Set the JMeter property beanshell.function.init to point to a file; add the following definition to the file:

No Format
// Fix ampersands in a string
String fixAmps(s) {
  return s.replaceAll("&","&");


the current release of JMeter already contains the fixAmps() function in the file BeanShellFunction.bshrc

The function can then be called as follows:

No Format


Code Block

The latter function call will store the result in the variable PLAIN_URL The work-rounds above can be extended to handle other transformations such as %20 -> space, %2F -> / and %3A -> :