PrintingController { @RequestMapping(value = "/printing", method = RequestMethod.GET) public ModelAndView printGet(@RequestParam("documentId") String documentId, @RequestParam(value = "download", defaultValue = DOWNLOAD_METHOD_SAVE, required = false) String download, @RequestParam(value = "name", defaultValue = "geomajas.pdf", required = false) String fileName, @RequestParam(value = "dpi", defaultValue = "72", required = false) int dpi) throws PrintingException { ModelAndView mav = new ModelAndView(); mav.setViewName(DOCUMENT_VIEW_NAME); mav.addObject(DOCUMENT_KEY, printService.removeDocument(documentId)); mav.addObject(DOWNLOAD_KEY, download); mav.addObject(FILENAME_KEY, fileName); mav.addObject(FORMAT_KEY, Format.decode(fileName)); mav.addObject(DPI_KEY, dpi); return mav; }  @RequestMapping(value = "/printing", method = RequestMethod.GET) ModelAndView printGet(@RequestParam("documentId") String documentId,
			@RequestParam(value = "download", defaultValue = DOWNLOAD_METHOD_SAVE, required = false) String download,
			@RequestParam(value = "name", defaultValue = "geomajas.pdf", required = false) String fileName,
			@RequestParam(value = "dpi", defaultValue = "72", required = false) int dpi); @RequestMapping(value = "/printing", method = RequestMethod.POST) ModelAndView printPost(
			@RequestParam(value = "download", defaultValue = DOWNLOAD_METHOD_SAVE, required = false) String download,
			@RequestParam(value = "name", defaultValue = "geomajas.pdf", required = false) String fileName,
			@RequestParam(value = "template") String templateJson,
			@RequestParam(value = "pageSize", required = false) String pageSize,
			@RequestParam(value = "dpi", defaultValue = "72", required = false) int dpi); @ExceptionHandler ModelAndView exception(PrintingException exception, HttpServletResponse response); @PostConstruct void postConstruct(); static final String DOCUMENT_VIEW_NAME; static final String DOCUMENT_KEY; static final String DOWNLOAD_KEY; static final String FILENAME_KEY; static final String FORMAT_KEY; static final String DPI_KEY; static final String DOWNLOAD_METHOD_BROWSER; static final String DOWNLOAD_METHOD_SAVE; }
@Test public void testGet() throws Exception { DefaultDocument document = new DefaultDocument(printService.createDefaultTemplate("A4", true), null, getDefaultVisitor(-31.44, -37.43, 80.83f), new MapConfigurationVisitor(configurationService, printDtoService)); String documentId = printService.putDocument(document); ModelAndView mv = printingController.printGet(documentId, PrintingController.DOWNLOAD_METHOD_SAVE, "mydoc.pdf", 200); Assert.assertSame(document, mv.getModel().get(PrintingController.DOCUMENT_KEY)); Assert.assertEquals("mydoc.pdf", mv.getModel().get(PrintingController.FILENAME_KEY)); Assert.assertEquals(Format.PDF, mv.getModel().get(PrintingController.FORMAT_KEY)); }