Although Dagfinn used Apache Jersey, there was still a great of development work that was necessary.
I thought to myself – I like a challenge – what about trying to create the same app without any Java coding.
I used Spring Roo and used these commands:
project –topLevelPackage net.rhirsch.test –projectName restpoc
persistence setup –provider ECLIPSELINK –database HYPERSONIC_IN_MEMORY
entity jpa –class ~.domain.FeedEntry –testAutomatically
field string –fieldName senderName –sizeMax 50
field string –fieldName senderEmail
field boolean –fieldName isComment
field string –fieldName parent
field date –fieldName timeCreated –type java.util.Date
field string –fieldName feedText
json add –class ~.domain.FeedEntry
web mvc setup
web mvc all –package ~.controller
web mvc json add –jsonObject ~.domain.FeedEntry –class ~.controller.FeedEntryController
I changed the nwcloud.properties file to contain my properties
I then used maven to deploy the application to the NetWeaver Cloud:
mvn -Dmaven.test.skip=true package nwcloud:deploy nwcloud:start
A nice web User Interface.
I also got a working REST interface:
The generated REST interface is a bit flaky but it works.
Motto: Never underestimate the power of Spring Roo + NetWeaver Cloud.
JSON, REST, Persistence, WebUI in 16 lines of Roo code and a few maven commands.
Dagfinn’s application is probably a better foundation for a real app but for a quick prototype – nothing beats Roo.