Writing Java-backed web scripts
You now have a web script that returns all whitepapers, and a web script that returns the rating summary for a specific whitepaper. The next step is to implement a web script that supports the POST method so that people can submit new ratings.
Like all web scripts, the web script that creates ratings will run as the user executing the script. In this case, you are appending guest=true
to the URL, but we will use the runAs
property in the web script descriptor to run the code using the username admin
. Another way to handle this would be to set the web script's minimum authentication level to User
, give named users (or one or more groups) write access to the whitepapers folder, and make website users authenticated. But SomeCo doesn't want to set up user accounts for every user who might rate content. Any user ought to be able to rate content whether or not he or she can authenticate with Alfresco as a named user. So, we'll use the runAs
option. In this example...