Service inputs and outputs
Input and output properties are optional for any type of service but in most cases, a service will be defining at least one of either. In Gloop, you can define as many input or output properties you like through the Input/Output view.
Injectable input properties
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:
HttpServletRequestobject which contains the details of the HTTP request that triggered the service; and
MartiniPackageobject which contains the details of the Martini package containing the service.
There are multiple other injectable input properties. In Gloop, they include the following:
- Arguments that can be injected to services called by Martini endpoints, listed and described in every endpoint type's respective page;
- Parameters injected by Gloop steps, listed and described in each type's respective page; and
- Input variables brought by HTTP invokes.
Injecting input properties
To inject an argument in Gloop, you must declare the variable under the
Input/Output view. You can use the designated hotkeys or right click, pick a type, and then rename the
variable. In Gloop and Flux, the names of injectable arguments must be prepended by the
$ character. From there,
you can use the parameter by mapping.
The example below shows how you can obtain the
object in an HTTP-invokable service:
When a service is invoked via HTTP, a proxy is used to map inputs to the service. The proxy will then handle the injection of the variables for you.