Package server.controller

Source Code of server.controller.ModelController

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();
    }
}
TOP

Related Classes of server.controller.ModelController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.