Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Intercept highlighting request and update parameters
/*
To use, add to Highlighter's application.conf:
highlighter.service.scripting {
files = ["/path/to/highlighter-snoop-script.groovy"]
filterRequestParamsFn = "myRequestParamsFilter"
uriFilterFn = "myUriFilterFn"
}
If all setup fine, you should see below logged messages in highlighter.log
*/
import javax.servlet.http.HttpServletRequest
def init() {
log.info("My script is loaded: {}", scriptPath)
}
def myRequestParamsFilter(Map params, HttpServletRequest req) {
log.info("My request filter:")
log.info(" params: {}", params)
log.info(" request: {}", req)
// update params map here if you need...
}
def myUriFilterFn(String uri) {
String newUri = uri
// here we could do something here to transform received uri to a local file path for example
// ...
return newUri
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.