@Override
    public void service(HttpServletRequest request, HttpServletResponse response) {
        boolean compress = false;

        boolean javascript = request.getRequestURI().endsWith("scripts/");

        if (!disableCompression) {
            if (request.getHeader("accept-encoding") != null &&
                    request.getHeader("accept-encoding").contains("gzip")) {
                compress = true;
            }
            else if (request.getHeader("---------------") != null) {
                // norton internet security
                compress = true;
            }
        }

        if(javascript) {
            response.setHeader("Content-type", "text/javascript");
        }
        else {
            response.setHeader("Content-type", "text/css");
        }
        response.setHeader("Vary", "Accept-Encoding"); // Handle proxies

        if (!debug) {
            DateFormat formatter = new SimpleDateFormat("d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
            formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
            response.setHeader("Expires", formatter.format(Instant.now().plus(expiresOffset)));
            response.setHeader("Cache-Control", "max-age=" + expiresOffset.toSeconds());
        }
        else {
            response.setHeader("Expires", "1");
            compress = false;
        }

        try {
            byte[] content;
            String cacheKey = compress + " " + javascript;
            content = cache.get(cacheKey);
            if (javascript && (debug || content == null)) {
                content = getJavaScriptContent(compress);
                cache.put(cacheKey, content);
            }
//            else if(!javascript && content == null) {
//
//            }

            response.setContentLength(content == null ? 0 : content.length);
            if (compress) {
                response.setHeader("Content-Encoding", "gzip");
            }

            // Write the content out
            if (content != null) {
                try (ByteArrayInputStream in = new ByteArrayInputStream(content)) {
                    try (OutputStream out = response.getOutputStream()) {

                        // Use a 128K buffer.
                        byte[] buf = new byte[128 * 1024];
                        int len;
                        while ((len = in.read(buf)) != -1) {
                            out.write(buf, 0, len);
                        }
                        out.flush();
                    }
                }
            }
        }
        catch (IOException e) {
            Log.error(e.getMessage(), e);
        }
    }
Combines and serves resources, such as javascript or css files.
xmppserver/src/main/java/org/jivesoftware/openfire/http/ResourceServlet.java