Created
December 31, 2013 15:42
-
-
Save riteshmodi/8198582 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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