Skip to content

Instantly share code, notes, and snippets.

@riteshmodi
Created December 31, 2013 15:42
Show Gist options
  • Select an option

  • Save riteshmodi/8198582 to your computer and use it in GitHub Desktop.

Select an option

Save riteshmodi/8198582 to your computer and use it in GitHub Desktop.
package org.resteasy.rest;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.resteasy.model.Person;
@Path("/person")
public class SampleResource {
@GET
@Path("/all")
@Produces(MediaType.APPLICATION_JSON)
public List<Person> printPerson() {
List<Person> personList = new ArrayList<Person>();
String[] names = {"Jon","Smith"};
int age = 25;
for(String name:names){
personList.add(new Person(name,age));
age++;
}
return personList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment