Archive for April, 2009
I’ve been the lead developer for MyEclipse web service developer tools for almost two years now. Until recently we had concentrated all of our energy on the heavyweight SOAP web service technology stack. Yet, the lightweight REST web service movement was something we had been researching and planning to support. The question was when would we add that support for MyEclipse….
At my EclipseWorld presentation, I gave a talk on web services. To elicit the audience’s interest in REST, I demonstrated ad hoc REST development using MyEclipse 6.5. Now MyEclipse 6.5 web service tools did not explicitly support REST, so I improvised for my demo. With a few hours of trial and error web project setup and configuration I was able to create a helloworld REST web service project that I could deploy and test. I mention this ME 6.5 experiment with REST web services and the troublesome and time consuming process as a contrast to the convenience of the new MyEclipse 7.0 REST web service features.
MyEclipse 7.0 introduced REST developer tools that make REST web service development drop-dead simple with no configuration complexity, Maven or otherwise; create a REST web services project in a few clicks. Jersey 1.0 libraries and dependent JARs are split among a few MyEclipse containers to help you choose exactly what you need for your application. If you want to manage your dependencies with Maven, that’s possible too, all you have to do is check a box, MyEclipse will deal with your pom.xml dependencies for you.
To create a web service, select a class (or create a new one), specify the path, add a few methods and you’re done.
The method wizard can be invoked from the above class wizard to add new methods or directly from the Java editor to add methods to a class you are currently editing.
If you’re a MyEclipse PRO subscriber, you can use the REST Web Services Explorer to test your web service from within the IDE.
For all their coolness though, the wizards in MyEclipse 7.0 had no editing support. You could use them to add a new class or add methods, but you could not use them to edit existing classes or methods. This left you hanging when it came to modifying existing service annotations. REST with JAX-RS is annotation heavy, and a complex method could have at least 10 annotations and you certainly wouldn’t want to be editing those by hand if you could avoid it.
In MyEclipse 7.1, I worked in the editing support for both the method and the class wizards. You can bring up the editor from the context menu in the Java editor, Outline view, Package explorer, etc. Just select (or place your cursor in) the method or class you want to edit and bring up the context menu to invoke the wizard.
The wizard will open pre-populated with all the REST annotations filled into it’s fields. You can now add, edit or delete annotations. You can even add and remove parameters from methods. When you hit finish, only the changes you made are written back to the editor, you don’t have to worry about losing any other (non REST) changes you may have made manually.
One of my favorite things about these wizards is the ability to invoke them while typing using Ctrl + 3. So if you’re in the middle of editing your code and you want to bring up the wizard, press Ctrl + 3, type in “edit rest” and choose the wizard you want. Much faster than moving your hand over to the mouse and selecting from the context menu, I say.
In 7.1, we also moved on to Jersey 1.0.2, which brings in a new MIME and Multipart API and a large number of fixes and enhancements. The REST Web Services Explorer will now display JSON output in the Raw View, you no longer need to save it as a file and then open externally.
The intuitiveness of the REST tools are all about making REST development a no-brainer hassle-free experience. The Eclipse World demo I discussed at the beginning of this post took me under five minutes to finish with our REST tools. Now you’re probably thinking, “But isn’t REST supposed to be easy? Why do I need tools for a process that is easy?”. True, but only once you know all the principles behind the process and have gone through the initial error prone setup; hopefully not having quit due to sheer frustration! Even after you know what is involved, execution is still a manual process for most part and will still take time, no matter how much you know. Why spend hours pottering with your dev environment, research and syntax when you can just use MyEclipse? Spend the time working on a bad-ass service for your customers instead and let us do the heavy lifting for you.
We have plenty of ideas for future REST features; Spring integration, JPA integration, WADL support for top down service / client generation, … how about you tell us? We’re listening.
Do read our MyEclipse REST / JAX-RS tutorial for more details.