Skip to content




JAR services

API Explorer

Groovy service inputs and outputs

The signature of a Groovy method indicates expected service inputs and output.

Injectable arguments

When a service is made invokable via HTTP or used in a Martini endpoint, additional input variables can be injected for further use. All you need to do is declare the input variables needed by your service and ensure they are named accordingly. Martini won't inject arguments for parameters which do not follow expected parameter names.

Example injectable input variables are:

There are multiple other injectable arguments. In Groovy, they include the following:

Injecting arguments in scripts

Since Groovy scripts don't have declared inputs or outputs, Martini will place all the available data in a binding for you. It will execute your Groovy script with the binding, giving it access to all variables. Below is a simple piece of code that logs the HTTP request object to the Martini logger at the INFO level:

"Hello, world! The request used to invoke me is ${request}.".info()

Injecting arguments in methods

Unlike Groovy scripts, Groovy methods declare their input variables. To do something similar to the Groovy script example earlier, declare the variable as a parameter. For example, the method below publishes the string to a JMS queue.

void helloWorld(HttpServletRequest request) {
    "Hello, world! The request used to invoke me is ${request}.".publishTo('queue://my.jms.HTTPQueue')