Skip to content
sochka edited this page Nov 23, 2014 · 10 revisions

Widgets are high-level abstractions, pieces using which Pages are built.

From developer's view widget is a directory located in resources and called WIDGET_NAME where WIDGET_NAME is widget's unique name. It should have the following layout:

  • widget.json (required, contains the most important descriptional information about widget. Example for summator widget:
{
    "description": "Description of widget \"summator\"",
    "schema": {
      "type": "object",
      "title": "Summator settings",
      "properties": {
        "title": {
          "type": "string",
          "title": "Widget title"
        },
        "a": {
          "type": "integer",
          "title": "Default value for first input"
        },
        "b": {
          "type": "integer",
          "title": "Default value for second input"
        },
        "aDisabled": {
          "type": "boolean",
          "title": "Should first field be disabled?"
        }
      }
    }
  }

When the widget is uploaded this information should be merged into resources/widgets.json in the following way: JSON object is wrapped into another JSON object like this: { "WIDGET_NAME": OLD_JSON_OBJECT } and then merged with existing JSON-object located in widgets.json.

  • widget.html (optional)
  • widget.js (optional)

When the widget archive is uploaded using PUT-request to address /widgets/WIDGET_NAME it should be unzipped into /resources/widgets/WIDGET_NAME. All files should be checked to be safe (there should be a white-list of allowed files: image files, text files, *.js, *.css, *.html, *.txt files and probably a few others. Java code uploading should be strictly prohibited!

All the paths are relative to src/main/webapp.

Clone this wiki locally