getting list of objects from REST/Json using RestEasy

Posted: August 8, 2012 in web
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.util.GenericType;


private List<SomeClass> someMethod() {
        try {
            return (new ClientRequest("some REST URL that return json string")).get(ClientResponse.class)
                    .getEntity(new GenericType<List<SomeClass>>() {
        } catch (Exception e1) {
            // TODO Auto-generated catch block


Leave a Reply

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

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

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s