/CSD4464-Heroku-2019W

Sample of using JAX-RS and AngularJS on Embedded Tomcat with Jersey on Heroku

Primary LanguageJava

Heroku + JAX-RS + EmbeddedTomcat Sample

This sample is a combination of things, some drafted from the Heroku documentation, and others drafted from a collection of stalwart JAX-RS adventurers.

The API endpoints are:

/api
    /hello         <-- A basic Hello World Example
    /faker/{count} <-- A "Fake Data Generator" Example
    /dbsample      <-- A "SELECT * FROM sample" Example

The Sources:

This provides a very basic "Fake Data" API (no POST/PUT/DELETE) that is wildly inconsistent. The API is consumed by a simple AngularJS table generator.

The biggest tricks I dealt with on my conversion from Glassfish/Wildfly to Embedded Tomcat were:

  • @ApplicationPath is not used, instead the path is determined when adding servlets
  • The JSON MessageBodyWriter is not added by Jersey by default, and must be registered