This module contains a simple Jersey/Grizzly based REST application to send out an email greeting.
To build the application run:
mvn install
Once the module is built it generates a zip file in the target directory that contains the rest application along with configuration, email templates, and scripts files.
To run the application perform the following:
- Unpack the zip file in "target/rest-x.x.x.bin.tar.gz"
- Change directory to the bin director
- Run the start script
./start.sh
Once the application starts make sure the application WADL is accessible by going to the following url:
To send a holidays greeting use curl to post a JSON entity of the user you wish to send greetings to:
curl -v -H "Content-Type: application/json" -X POST -d '{"firstName":"First Name", "lastName":"Last Name", "email": "local.part@domain.part"}' http://localhost:1979/api/greetings/holidays
To send a birthday greeting use curl to post a JSON entity of the user you wish to send greetings to:
curl -v -H "Content-Type: application/json" -X POST -d '{"firstName":"First Name", "lastName":"Last Name", "email": "local.part@domain.part"}' http://localhost:1979/api/greetings/birthday
Note that the json payload is validated using hibernate validator. The entity must have a non-blank first and last name, and the email must be a valid email address. In addition the content of first and last name and email must be safe html and don't contain malicious code, such as embedded <script> elements.