Web Script Architecture
A Web Script is simply a service bound to a URI which responds to HTTP methods such as GET, POST, PUT and DELETE; which also can be deployed as a JSR portlet is any standard and compatible container.
The basic components of a Web Script are
- Declaration XML File.
- Presentation Freemarker Template.
The XML file defines the URI and other behaviors of the web script.
The Freemarker (FTL) file constructs final contents returned by the web script.
You can return a variety of different data from the web script, by defining different FTL templates. In our example, we have defined only one output type - HTML, since we have created one FTL file - helloworld.get.html.ftl. Similarly define other templates to return other data structures such as
- text => text/plain
- xml => text/xml
- atom => application/atom+xml
- rss => application/rss+xml
- json => application/json