private void registerJavascriptFiles() throws IOException { ContentBuffer contentBuffer = new ContentBuffer(); String appearanceCode = getQxAppearanceThemeCode(); if (RWTProperties.isDevelopmentMode()) { for (String javascriptFile : JAVASCRIPT_FILES) { append(contentBuffer, javascriptFile); } } else { append(contentBuffer, CLIENT_JS); } String json2Code = readResourceContent(JSON_MIN_JS); contentBuffer.append(json2Code.getBytes(HTTP.CHARSET_UTF_8)); contentBuffer.append(appearanceCode.getBytes(HTTP.CHARSET_UTF_8)); registerJavascriptResource(contentBuffer, "rap-client.js"); }
private void registerJavascriptResource(ContentBuffer buffer, String name) throws IOException { InputStream inputStream = buffer.getContentAsStream(); try { resourceManager.register(name, inputStream); } finally { inputStream.close(); } String location = resourceManager.getLocation(name); applicationContext.getStartupPage().setClientJsLibrary(location); }
private void append(ContentBuffer contentBuffer, String location) throws IOException { InputStream inputStream = openResourceStream(location); try { contentBuffer.append(inputStream); } catch (Throwable t) { System.out.println(); } finally { inputStream.close(); } }