Properties Containing Closures

Extended class should also set closures for one or more of the following properties: execGet, execPut, execPost, and execDelete depending on which HTTP action or actions you need to support for the following URI. Each closure has dynamic arguments lists. Below is a list of arguments passed to closure which describes how and when the list of arguments change.

  1. service: Implementation of Service interface, used to access database or send/recieve XMPP stanzas.
  2. callback: Closure which needs to be called to return data. Accepts only one argument of type String,byte[],Map. If data is type of Map it will be encoded to JSON or XML depending on 'Content-Type' header.
  3. user: Will be passed only if requiredRole is not null. In other cases this argument will not be in arguments list!
  4. content: Parsed content of the request. Will not be in arguments list if Content-Length of request is empty. If Content-Type is of XML or JSON type, type returned as Map. Otherwise it will be an instance of HttpServletRequest.
  5. x: Additional arguments passed to callback are groups from regular expression matching URI. Groups are not passed as list, but are added to a list of arguments as next arguments.

If the property for corresponding HTTP action is not set, the component will return a 404 HTTP error.