-
Implemented simple rendering of generic HTML as result of handler by adding support for creation of templates for every result of every handler. If we create proper file (compatible with GStringTemplateEngine) and we put it under correct name (ie. UsersListGet.html in same folder as UsersList.groovy file containing handler for action GET) and in
AcceptHTTP header we will suggesttext/htmlas supported type then this renderer will be used to process results of handler before sending them to user. Every browser sendsAcceptHTTP header containingtext/htmlpart as most important accepted result of request so this rendering mechanism would be triggered by every request from browser if it is not changes or if request will not contain HTTPtypeparameter set to other value (ie.application/xmlor @application/json@)Example file template files are available in project directory next to groovy handlers.
I also introduced support for
headerandfooterfiles which might be placed in top directory of rest scripts and might contain header and footer parts of page to incude by template files for particular handlers.
| Type |
New Feature
|
| Priority |
Normal
|
| Assignee | |
| RedmineID |
2094
|
Currently it is only possible to return bytes, string, or Map to be rendered as XML or JSON as result of processing by HTTP API handlers. It would be good to extend this to allow to render HTML, so it would be possible to create pages with documentation or pages with human readable results as result of processing by HTTP API handlers.
Type of returned result should depend (same as until now) on
Content-TypeHTTP header andtypeHTTP parameter of a request.Returned result in HTML should use default style of Tigase installation, see #1751, #1752