private static byte[] getJavaScriptContent(boolean compress) throws IOException
    {
        StringWriter writer = new StringWriter();
        for(String file : getJavascriptFiles()) {
            writer.write(getJavaScriptFile(file));
        }
        
        if (compress) {
            try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
                try (GZIPOutputStream gzos = new GZIPOutputStream(baos)) {
                    gzos.write(writer.toString().getBytes());
                    gzos.finish();
                    gzos.flush();
                    return baos.toByteArray();
                }
            }
        }
        else {
            return writer.toString().getBytes();
        }
    }
Combines and serves resources, such as javascript or css files.
xmppserver/src/main/java/org/jivesoftware/openfire/http/ResourceServlet.java