I remember reading a blog from dagfinn.parnas entitled “Exposing a REST API from #SAPNWCloud” in which he describes how to create an application on NetWeaver Cloud that supports REST.
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
nwcloud enable-deploy
nwcloud enable-jpa
quit
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |