Extended class should also set closures for one or more of following properties: execGet, execPut, execPost, and execDelete depending on which HTTP action or actions you need to support for the URI. Each closure has a dynamic arguments list. Below is list of arguments passed to closure which describes how and when the list of arguments changes:
- service - Implementation of Service interface. This is used to access the server database or send/receive XMPP stanzas.
- callback - The
callback
closure needs to be called to return data.callback
accepts only one argument of type String,byte[],Map. If data is type of Map it will be encoded to JSON or XML depending of 'Content-Type' header. - user - Will be passed only if
requiredRole
is not null. In all other cases this argument will not be in arguments list! - request - Will be passed only if declared as instance of
HttpServletRequest
and it will be instance ofHttpServletRequest
of the current HTTP request. - content - Parsed content of request. This closure will not be in arguments list if Content-Length of request is empty. If Content-Type
is XML or JSON returned as Map, otherwise (or if
decodeContent
is set tofalse
) it will be an instance ofHttpServletRequest
. - x - Additional arguments passed to callback are groups from regular expression matching the URI. Groups are not passed as a list, but are added to list of arguments as next arguments.
If property for corresponding HTTP action is not set, then the component will return a 404 HTTP error.