Is is possible to bind my own closures and variables to groovlet?

172 views Asked by At

There are some variables and closures in groovlet like request, response, out, forward, redirect...

Is it possible to bind my own variables and closures to groovlet automatically?

I want this feature for ${escapeHtml(params.value)} like things.

1

There are 1 answers

0
ataylor On

GroovyServlet provides a hook for doing exactly this: setVariables. Create a subclass of GroovyServlet that overrides this method and populate the ServletBinding with whatever you want.