@Test public void testGet() throws Exception { MvcResult result = mvc.perform(get("/app/api/projections/epsg:3005")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); JSONObj proj = JSONWrapper.read(result.getResponse().getContentAsString()).toObject(); assertEquals("EPSG:3005", proj.str("srs")); assertNotNull(proj.str("wkt")); }
@RequestMapping(value = "/{srs}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String srs) throws Exception { srs = srs.toUpperCase(); CoordinateReferenceSystem crs = null; try { crs = Proj.get().crs(srs); } catch(Exception e1) { throw new BadRequestException("Bad srs: " + srs, e1); } if (crs == null) { throw new NotFoundException("No such projection: " + srs); } return IO.proj(new JSONObj(), crs, srs); }
ProjController extends ApiController { @RequestMapping(value = "/{srs}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String srs) throws Exception { srs = srs.toUpperCase(); CoordinateReferenceSystem crs = null; try { crs = Proj.get().crs(srs); } catch(Exception e1) { throw new BadRequestException("Bad srs: " + srs, e1); } if (crs == null) { throw new NotFoundException("No such projection: " + srs); } return IO.proj(new JSONObj(), crs, srs); } }
ProjController extends ApiController { @RequestMapping(value = "/{srs}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String srs) throws Exception { srs = srs.toUpperCase(); CoordinateReferenceSystem crs = null; try { crs = Proj.get().crs(srs); } catch(Exception e1) { throw new BadRequestException("Bad srs: " + srs, e1); } if (crs == null) { throw new NotFoundException("No such projection: " + srs); } return IO.proj(new JSONObj(), crs, srs); } @Autowired  ProjController(GeoServer geoServer); }
ProjController extends ApiController { @RequestMapping(value = "/{srs}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String srs) throws Exception { srs = srs.toUpperCase(); CoordinateReferenceSystem crs = null; try { crs = Proj.get().crs(srs); } catch(Exception e1) { throw new BadRequestException("Bad srs: " + srs, e1); } if (crs == null) { throw new NotFoundException("No such projection: " + srs); } return IO.proj(new JSONObj(), crs, srs); } @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 = "/{srs}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String srs) throws Exception { srs = srs.toUpperCase(); CoordinateReferenceSystem crs = null; try { crs = Proj.get().crs(srs); } catch(Exception e1) { throw new BadRequestException("Bad srs: " + srs, e1); } if (crs == null) { throw new NotFoundException("No such projection: " + srs); } return IO.proj(new JSONObj(), crs, srs); } @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();  }