CKFinderController { @ResponseBody @GetMapping(value = "webjars/ckfinder/2.6.2.1/config", produces = {"application/javascript", "text/javascript"}) public String configJs(Locale locale) { final String indent = " "; StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { pw.println("CKFinder.customConfig = function(config) {"); pw.println(indent + " pw.println(indent + " pw.println(indent + " pw.println(); pw.println(indent + " pw.println(indent + " if (locale != null) { String fallback = locale.toLanguageTag().toLowerCase(Locale.US); String lang = messageSource.getMessage("ckfinder.lang", new Object[0], fallback, locale); pw.println(indent + "config.language = '" + lang + "';"); } pw.println(indent + "config.removePlugins = 'help';"); pw.println("};"); } return sw.toString(); }  @GetMapping("/userfiles/{first}/**") void attachment(HttpServletRequest request, HttpServletResponse response,
            @PathVariable("first") String first); @ResponseBody @GetMapping(value = "webjars/ckfinder/2.6.2.1/config", produces = {"application/javascript", "text/javascript"}) String configJs(Locale locale);  }
@Test public void testConfigJs() throws Exception { log.info("configJs"); MvcResult result = testConfigJsBase("pt-BR", "pt-br"); result = testConfigJsBase("zh", "zh-cn"); result = testConfigJsBase("zh-TW-x-lvariant-Hant", "zh-tw"); result = testConfigJsBase(null, "en"); result = testConfigJsBase("", "en"); }