[jboss-user] [JBoss Tools] - Overview of the JAX-RS support in JBoss Tools 3.3M2

Xavier Coulon do-not-reply at jboss.com
Thu Jun 30 20:36:59 EDT 2011


Xavier Coulon [http://community.jboss.org/people/xcoulon] modified the blog post:

"Overview of the JAX-RS support in JBoss Tools 3.3M2"

To view the blog post, visit: http://community.jboss.org/community/tools/blog/2011/06/30/jax-rs-tooling-coming-in-jbosstools-330

--------------------------------------------------------------
Following the release of JBoss Tools 3.3M2 that was  http://community.jboss.org/en/tools/blog/2011/06/28/fast-faster-jboss-tools-33-m2 announced yesterday, this article highlights the main features provided by the new JAX-RS tooling which is part of this new milestone.

h3. Installing the plugin
As explained in the announcement, the fastest and easiest way to get started with JBoss Tools is to download & install the  http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/indigor Eclipse 3.7 (Indigo) JEE bundle. Once you have installed Eclipse, you use our update site directly.

The updatesite URL to use from Help > Install New Software... is:

 http://download.jboss.org/jbosstools/updates/development/indigo/ http://download.jboss.org/jbosstools/updates/development/indigo/
Then, go to the "All JBoss Tools 3.3" section and select "JBoss JAX-RS Tools"
 http://community.jboss.org/servlet/JiveServlet/showImage/38-3884-16612/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+22.05.46.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3884-16612/450-359/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+22.05.46.png 
Using a sample project
A quick way to get started with the tooling is to download the *JBoss AS7 Quickstarts* from their  http://download.jboss.org/jbossas/7.0/jboss-7.0.0.CR1/jboss-as-quickstarts-7.0.0.CR1-dist.zip download page. Once you've unzipped the archive, import the "*KitchenSink"* project into your workspace using the Import > Existing Maven Project menu.

 (i)  You'll need to install the m2eclipse plugin to import the project.

 http://community.jboss.org/servlet/JiveServlet/showImage/38-3884-16620/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+22.52.57.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3884-16620/450-442/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+22.52.57.png 

Activating the support for JAX-RS
One way to activate support for JAX-RS in your project is to click on "Configure > Add JAX-RS 1.1 support..." in the project's contextual menu, which in turn will add the "JAX-RS Nature" to it.
 http://community.jboss.org/servlet/JiveServlet/showImage/38-3880-16549/jaxrs_install.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3880-16549/jaxrs_install.png 


If the project you're working on is a "Dynamic Web Project", you can also install the standard Eclipse "JAX-RS (REST Web Services)" Facet, which will in turn will add the "JAX-RS Nature" as described in the previous case.

 http://community.jboss.org/servlet/JiveServlet/showImage/38-3880-16550/jaxrs_facet.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3880-16550/jaxrs_facet.png 
In both cases, a "JAX-RS Builder" will be added to your project.

h3. Current features
In this milestone, the JAX-RS Builder offers the features described below.
h5. Mapping of JAX-RS elements to the source
The JAX-RS Builder computes and keeps in sync' an im-memory metamodel of the JAX-RS elements of your project. The metamodel is reinitialized during a clean/full build of your project, and all kinds of changes to compilation units are applied to the metamodel.      

h5. RESTful Web Services explorer
The *RESTful Web Services* outline in the the *Project Explorer* view is certainly the most attractive feature of this plugin, as it displays the resolved URI Path Templates based on the metamodel described above.

The URI Path Templates resolution works with both Methods and Submethods of Root Resources and Subresources. In addition, each node in the outline indicates the consumed and produced media-types and the Java method that would be called when a request matching the combo {HTTP Method + URI Path Template + Content Negociation}. Double-clicking on the elements of the outline opens the Java Editor to the associated location in the source code.
 http://community.jboss.org/servlet/JiveServlet/showImage/38-3884-16627/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+23.14.50.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3884-16627/449-270/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+23.14.50.png 

Event tough the classes annotated with the @javax.ws.rs.ext.Provider are not shown on the Project Explorer's view yet, they are already taken into account by the JAX-RS Builder, so you can expect further features around those elements in the next releases.

h5. Code completion for JAX-RS annotation values
Code completion for @javax.ws.rs.PathParam annotation value is available. The completion processor analyses the source of the Java Type to return proposals based on the @javax.ws.rs.PathParam annotations values both at the method and at the type levels. The additional information of each proposal highlights the part of the code from which the proposal was computed.
 http://community.jboss.org/servlet/JiveServlet/showImage/38-3884-16628/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+22.57.51.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3884-16628/450-137/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+22.57.51.png 
Those completion proposals support the regular expressions, too.

h5. Validation of JAX-RS constructs
The plugin currently validates that a method parameter annotated with @javax.ws.rs.PathParam annotation matches with the @javax.ws.rs.Path annotation value on the same method.
 http://community.jboss.org/servlet/JiveServlet/showImage/38-3884-16626/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+23.00.26.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3884-16626/450-163/Capture+d%E2%80%99%C3%A9cran+2011-06-30+%C3%A0+23.00.26.png 


That's it for now. Remember that the tooling is not yet complete but is very functional and we are looking forward to get feedback on its current functionality and what you would like to see in the future !

Have fun !

PS : as an individual contributor, I'd also like to thank the JBoss Tools team for the support and confidence they've put in the work I've done so far. As  http://community.jboss.org/people/maxandersen Max Andersen says, it's the way OSS works, and it's really great !
--------------------------------------------------------------

Comment by going to Community
[http://community.jboss.org/community/tools/blog/2011/06/30/jax-rs-tooling-coming-in-jbosstools-330]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110630/206fecf0/attachment-0010.html 


More information about the jboss-user mailing list