Skip to content

Instantly share code, notes, and snippets.

@mariusoe
Created December 2, 2019 10:06
Show Gist options
  • Save mariusoe/663caa791c0964cbc7e39f27c83b7ef3 to your computer and use it in GitHub Desktop.
Save mariusoe/663caa791c0964cbc7e39f27c83b7ef3 to your computer and use it in GitHub Desktop.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Action for extracting header fields of a HTTP requests
# processed by the Java Servlet API. If multiple headers
# with the specified name exists, only the first one
# will be returned.
#
# field : String
# The name of the header field to extract
#
# return
# The value of the header field with the given name
inspectit:
instrumentation:
actions:
a_extract_http_header:
imports:
- javax.servlet.http.HttpServletRequest
input:
_arg0: Object
field: String
value-body: |
if (_arg0 instanceof HttpServletRequest) {
HttpServletRequest hsr = (HttpServletRequest) _arg0;
String header = hsr.getHeader(field);
if (header != null) {
return header;
}
}
return "<not available>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment