package server.controller;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import server.SpringAwareResource;
import server.model.Model;
import server.repo.ModelRepository;
import com.sun.jersey.api.view.Viewable;
@Path("/view")
public class ModelController extends SpringAwareResource {
@Autowired
ModelRepository repo;
@GET
@Produces(MediaType.TEXT_HTML)
public Response main() {
LoggerFactory.getLogger(ModelController.class).info("main()");
Iterable<Model> modeles = repo.findAll();
Map<String, Iterable<Model>> map = new HashMap<String, Iterable<Model>>();
map.put("modeles", modeles);
// return new Viewable("/index", map);
return Response.ok(new Viewable("/main", map)).build();
}
}