@Test public void testRaw() throws Exception { MockGeoServer.get().catalog() .resources() .resource("workspaces/foo/styles/one.yaml", "title: raw") .directory("workspaces/foo/styles") .resource("workspaces/foo/styles/icon.png", "PNG8") .resource("workspaces/foo/styles/symbols.TTF", "TTF") .directory("styles") .resource("styles/global.png", "PNG") .geoServer().catalog() .workspace("foo", "http: .layer("one") .style().ysld("one.yaml") .geoServer().build(geoServer); MvcResult result = mvc.perform(get("/app/api/icons/foo/icon.png")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.IMAGE_PNG_VALUE)) .andReturn(); String raw = result.getResponse().getContentAsString(); assertEquals("PNG8",raw); result = mvc.perform(get("/app/api/icons/global.png")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.IMAGE_PNG_VALUE)) .andReturn(); raw = result.getResponse().getContentAsString(); assertEquals("PNG",raw); }
@RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) public HttpEntity raw(@PathVariable String icon) throws IOException { return raw(null, icon); }
IconController extends ApiController { @RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) public HttpEntity raw(@PathVariable String icon) throws IOException { return raw(null, icon); } }
IconController extends ApiController { @RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) public HttpEntity raw(@PathVariable String icon) throws IOException { return raw(null, icon); } @Autowired  IconController(GeoServer geoServer); }
IconController extends ApiController { @RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) public HttpEntity raw(@PathVariable String icon) throws IOException { return raw(null, icon); } @Autowired  IconController(GeoServer geoServer); @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody JSONArr list(HttpServletRequest request); @RequestMapping(value = "/list/{wsName:.+}", method = RequestMethod.GET) @ResponseBody JSONArr list(@PathVariable String wsName, HttpServletRequest request); @RequestMapping(value = "", method = RequestMethod.POST,consumes=MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value=HttpStatus.CREATED) @ResponseBody JSONArr create(HttpServletRequest request ); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.POST,consumes=MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value=HttpStatus.CREATED) @ResponseBody JSONArr create(@PathVariable String wsName,  HttpServletRequest request ); @RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) HttpEntity raw(@PathVariable String icon); @RequestMapping(value = "/{wsName}/{icon:.+}", method = RequestMethod.GET) HttpEntity raw(@PathVariable String wsName, @PathVariable String icon); @RequestMapping(value = "/{icon:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) void delete(@PathVariable String icon); @RequestMapping(value = "/{wsName}/{icon:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) void delete(@PathVariable String wsName, @PathVariable String icon); @ExceptionHandler(FileUploadException.class) @ResponseBody JSONObj error(FileUploadException e, HttpServletResponse response); @ExceptionHandler(IllegalArgumentException.class) @ResponseBody JSONObj error(IllegalArgumentException e, HttpServletResponse response); }
IconController extends ApiController { @RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) public HttpEntity raw(@PathVariable String icon) throws IOException { return raw(null, icon); } @Autowired  IconController(GeoServer geoServer); @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody JSONArr list(HttpServletRequest request); @RequestMapping(value = "/list/{wsName:.+}", method = RequestMethod.GET) @ResponseBody JSONArr list(@PathVariable String wsName, HttpServletRequest request); @RequestMapping(value = "", method = RequestMethod.POST,consumes=MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value=HttpStatus.CREATED) @ResponseBody JSONArr create(HttpServletRequest request ); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.POST,consumes=MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value=HttpStatus.CREATED) @ResponseBody JSONArr create(@PathVariable String wsName,  HttpServletRequest request ); @RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) HttpEntity raw(@PathVariable String icon); @RequestMapping(value = "/{wsName}/{icon:.+}", method = RequestMethod.GET) HttpEntity raw(@PathVariable String wsName, @PathVariable String icon); @RequestMapping(value = "/{icon:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) void delete(@PathVariable String icon); @RequestMapping(value = "/{wsName}/{icon:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) void delete(@PathVariable String wsName, @PathVariable String icon); @ExceptionHandler(FileUploadException.class) @ResponseBody JSONObj error(FileUploadException e, HttpServletResponse response); @ExceptionHandler(IllegalArgumentException.class) @ResponseBody JSONObj error(IllegalArgumentException e, HttpServletResponse response);  }