@Test public void testRecent() throws Exception { MvcResult result = mvc.perform(get("/app/api/projections/recent")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); JSONArr list = JSONWrapper.read(result.getResponse().getContentAsString()).toArray(); assertTrue(list.size() > 0); Iterables.find(list, new Predicate<Object>() { @Override public boolean apply(@Nullable Object input) { return "EPSG:4326".equals(JSONWrapper.wrap(input).toObject().str("srs")); } }); Iterables.find(list, new Predicate<Object>() { @Override public boolean apply(@Nullable Object input) { return "EPSG:3857".equals(JSONWrapper.wrap(input).toObject().str("srs")); } }); }
@RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody JSONArr recent() throws Exception { JSONArr arr = new JSONArr(); for (Map.Entry<String,CoordinateReferenceSystem> e : Proj.get().recent().entrySet()) { IO.proj(arr.addObject(), e.getValue(), e.getKey()); } return arr; }
ProjController extends ApiController { @RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody JSONArr recent() throws Exception { JSONArr arr = new JSONArr(); for (Map.Entry<String,CoordinateReferenceSystem> e : Proj.get().recent().entrySet()) { IO.proj(arr.addObject(), e.getValue(), e.getKey()); } return arr; } }
ProjController extends ApiController { @RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody JSONArr recent() throws Exception { JSONArr arr = new JSONArr(); for (Map.Entry<String,CoordinateReferenceSystem> e : Proj.get().recent().entrySet()) { IO.proj(arr.addObject(), e.getValue(), e.getKey()); } return arr; } @Autowired  ProjController(GeoServer geoServer); }
ProjController extends ApiController { @RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody JSONArr recent() throws Exception { JSONArr arr = new JSONArr(); for (Map.Entry<String,CoordinateReferenceSystem> e : Proj.get().recent().entrySet()) { IO.proj(arr.addObject(), e.getValue(), e.getKey()); } return arr; } @Autowired  ProjController(GeoServer geoServer); @RequestMapping(value = "/{srs}", method = RequestMethod.GET) @ResponseBody JSONObj get(@PathVariable String srs); @RequestMapping(value = "/recent", method = RequestMethod.GET) @ResponseBody JSONArr recent(); }
ProjController extends ApiController { @RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody JSONArr recent() throws Exception { JSONArr arr = new JSONArr(); for (Map.Entry<String,CoordinateReferenceSystem> e : Proj.get().recent().entrySet()) { IO.proj(arr.addObject(), e.getValue(), e.getKey()); } return arr; } @Autowired  ProjController(GeoServer geoServer); @RequestMapping(value = "/{srs}", method = RequestMethod.GET) @ResponseBody JSONObj get(@PathVariable String srs); @RequestMapping(value = "/recent", method = RequestMethod.GET) @ResponseBody JSONArr recent();  }