NetBeans REST support

Given that Java One begins next week, I wanted to mention some really interesting technology which is available in  NetBeans 6.0 (milestone 9 build). This preview release provides the ability to generate REST services based on a set of JPA entity beans, which you can also generate using NetBeans. The REST services are annotated using the annotations proposed in JSR-311 (so this will change by the time the JSR is finalized). JSR 311 removes the need for service developers to use the Servlet or JAX-WS and instead provides a runtime and a set of annotations to handle dispatching of requests to your REST enabled resources. This feature also requires installation of the Sun Web Developer Pack which contains Phobos (JavaScript application server), JMaki, and of course the RESTful web services supported.

The wizard determines the set of entity beans available in a project and allows a set of beans to be selected and exposed as resources. In addition to generating the rest resource code, the wizard generates a converter layer which provides the ability to marshal and unmarshal to and from the wire protocol. Currently, the converters are using custom XML to serialize data; however, JSON and ATOM publishing protocol are also being considered. Finally, the converter layer translates object references (such as JPA references) into URI references. All the code generated by NetBeans is freely editable (no guarded blocks) and only relies on the JSR-311 annotations.


Accompanying the wizard is the ability to generate a test client to exercise the generated resources. The test client supports interaction with resource collections as well as individual resources through GET, PUT, POST, and DELETE (depending on the options available via the resources). The test client is generated locall and uses XHR for communicating with the resources, which should mimic most common architectures.

This is best to see in action, check out the video

Comments:

Post a Comment:
Comments are closed for this entry.
About

cwebster

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today