JPF Page JSON ModeΒΆ

A JPF in json mode require to be marked as runable. A page marked as runable and the type is json will run the contents of the content field using groovy and return the return value as a json object. An example use case of this is for example you create a page to provide data for an ajax process. Typically a json page would be accessed using the following url:

http://<server_root>/json/<module>/<slug>/<arg1>/<arg2>/<arg3>/<arg4>/<arg5>

Where the arg1 until arg5 is just optional.

The variables made available for the developer are:

  1. postdata :- the POST value submitted by the user

  2. arg1,arg2,arg3,arg4,arg5 :- Additional variables the developer can use optionally in the url

  3. request :- the request object of this current request

  4. env :- the enviroment object of this current request. Can be used to access variables set in the runtime environment or even application.properties settings

  5. namedjdbctemplate :- the namedjdbctemplate object which the developer can use to run custom queries to the database

  6. javaMailSender :- the javamailsender object to use to send emails

  7. passwordEncoder :- the password encoder in case the page processing requires to hash user password

  8. trackerService :- the service to manage and manipulate trackers and their data

  9. userService :- the service to access information about users including the currently login user

  10. settingService :- the service to manage and use settings

  11. fileService :- the service to manage and use files uploaded as FileLink

  12. treeService :- the service used to manage and manipulate tree structures in the portal

To program using groovy is explained further in the Using Groovy in a JPF Page section.