Description
The env and metrics endpoints allow a subset of their output to be selected using a regular expression. It is currently passed in as a path variable and path variable's purpose is overloaded: it can either be the name of a single entry or a pattern that matches multiple entries. This overloading leads to problems with determining what should or should not be treated as a regular expression.
Another, perhaps more serious, problem is that Tomcat does not permit \
characters in the path of a URL by default. They can be permitted by setting a system property but that's not a good general-purpose solution. The restriction on the use of \
is problematic as it's used to escape characters that otherwise have a special meaning in a regular expression. For example, it's currently impossible to use a regular expression that matches all metrics with a .
in the name as the .
cannot be escaped.
In short, by moving to a query parameter for the pattern we'll see two benefits:
- It will be clear that the input is intended to be a regular expression rather than the name of an entry
- Regular expressions that require the escaping of special characters will work on Tomcat