Rest service is not getting called. I used this simple example based on RestyGWT video, but the issue is when I type localhost:8888/api/hellos it does not call this below service. If you see I have used @Path, do I need to specify this path in web.xml too or someplace else?
import java.util.HashMap;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import com.google.api.client.util.Lists;
import com.zrsol.tours.shared.Hello;
@Path("/api/hellos")
public class HelloResource {
private HashMap<String, Hello> database;
public HelloResource(){
System.out.println("Inside HelloResource......");
database = new HashMap<String, Hello>();
Hello helloFirst = new Hello("1", "First");
Hello helloSecond = new Hello("2", "Second");
database.put(helloFirst.getId(), helloFirst);
database.put(helloSecond.getId(), helloSecond);
}
@GET
@Produces("application/json")
public List<Hello> getAll(){
return Lists.newArrayList(database.values());
}
@GET
@Produces("application/json")
@Path("/{id}")
public Hello get(@PathParam("id") String id){
return database.get(id);
}
}