Development Environment II

I’ve been rethinking using Eclipse as my Java & HTML5/JavaScript IDE of choice since discovering that NetBeans 7.3 supports both, and with integrated Chrome JavaScript debugging and Twitter Bootstrap, BackBone.js and Jersey RESTful WebServices support it seems too good to be true. But after getting a couple of building a couple of simple apps with NetBeans it could be time to wave goodbye to Eclipse plugin hell and say hello to NetBeans simplicity.

One thing I couldn’t figure out was why the CustomerDBSpring sample app and the CustomerRestfulService  app were producing different JSON. It turns out it was all down to how Jersey was configured to convert Java to JSON. This guy describes the problem well and the first solution that I tried, but clearly that wasn’t a great long term option. The longer term solution was to use Jersey’s POJO support, which basically amounts to sticking this in your web.xml.

<init-param>
  <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
  <param-value>true</param-value>
</init-param>

BTW I don’t usually blog on a Saturday night, not that I’m saying there is anything wrong with that, but its just that my wife is watching the final of Strictly Come Dancing 😦

Advertisement

4 thoughts on “Development Environment II

  1. Awesome find there on the POJO support setting!

  2. Essentially what you are doing with this feature is changing how you are mapping the object to JSON and back. With my example, I am using JAXB, whereas by turning on the POJO support you are using Jackson to map the POJOs ignoring the JAXB annotations. I’m not sure specifically why this lands you more with what you want in this case, but if it works that is great. Interested to hear more about how you are liking Netbeans vs Eclipse – it has been a long time since I looked at Netbeans for development.

    • Fair point, I was looking for a simple solution where I didn’t have to override each and every Backbone client’s parse method to handle the (valid but apparently unexpected) JSON returned by the Jersey RESTful services. Perhaps the JAXB approach also allows this but I don’t have the time to explore that option.

      So far my experience with Netbeans has been pretty good thanks. It supports everything I’m looking for at the moment quite well; HTML5, Bootstrap, Backbone, JSON and the Java EE 6 Web Profile (JAX-RS and JPA). I like the generate “RESTful WebServices from Database…” and the “RESTful Javascript Client…” wizards. I’ve used Eclipse (usually after a painful setup post upgrade) for years but I get the feeling that it is now being left behind by the the likes of NetBeans and IntelliJ.

      BTW I’m writing this while waiting for my Sony Entertainment Network accounts to be setup, which is a painfully slow process, so that my wee boy can get a working PSVita with FIFA 13 in the morning. Santa is just is so inconsiderate, he should have sorted this out before now!

      • I hadn’t seen the “RESTful WebServices from Database” option before – tried it out and that is quite slick…especially for quickly throwing together prototypes. I tend to like more separation between the database and services in a real application, but for quick examples that is great. Haven’t tried the RESTful Javascript Client wizard yet but plan to.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: