Rest and JSON in JQuery - Twitter Gadget

I am sure you guys must have seem lot of gadget floating around the web for twitter, yahoo, google and what not.

Did you ever thought that writing a small gadget is such a small and minutes job with jquery and the apis exposed by these social networking sites like facebook and twitter. I just tried hands on one of the those and it was quick to get this twitter gadget ready to be shared.

Simple JSON script like the one below can do the whole trick for you.

var tweeturl = "
$.getJSON(tweeturl, function(data){
$.each(data, function(i, item) {

').addClass(i%2 ? 'even' : 'odd')

Interface handling in REST and JAXB

It is a very common scenario when you are writing a class implementing and interface and your parameters to the classes are interfaces.


public interface Person {}

public class Employee implements Person {}

public class MyEmployeeResources {
public void putEmployee(Person person) {...}

In the above example you will get an error with Jersey or RESTEasy as they both don't know the implementation of Person are JAXB class, hence they don;t have the context of JAXB.

Really cool alternative to this was to use @XMLSeeAlso annotation. something like below

public interface Person {}

This way JAXB creates the JAXBContext of Person, because it knows that it can be unmarshal with Employee or Student class.

Similarly @XMLSeeAlso can be used with JAX-WS.