tree: ff6a0dd46f653d20d62442a765fefe6a22db7760 [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.MD
examples/json-binding-webapp/README.MD

JSONB Example

This example demonstrates how to use JSONB with resource classes.

Contents

The mapping of the URI path space is presented in the following table:

URI pathResource classHTTP methods
/jsonb/cats/oneJsonbResourceGET
/jsonb/cats/allJsonbResourceGET
/jsonb/cats/addJsonbResourcePOST
/jsonb/cats/addAllJsonbResourcePOST

Running the Example

Run the example as follows:

mvn clean compile exec:java

This deploys the example using Grizzly container. You can access the application at:

or you can post an xml entity:

curl -v -X POST http://localhost:8080/json-binding-webapp/cats/add -H “Content-Type:application/json” -d ' {“color”:“white”,“sort”:“maine coon”,“catName”:“Darwin”, “domesticated”:“true”}'

You can also use the built war file to deploy the app to a container of your choice.