@Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) {
        final String host = request.getParameter("host");

        // OF-1885: Ensure that the provided value is a valid hostname.
        if (!InetAddresses.isInetAddress(host) && !InternetDomainName.isValid(host)) {
            LOGGER.info("Request for favicon of hostname that can't be parsed as a valid hostname '{}' is ignored.", host);
            writeBytesToStream(defaultBytes, response);
            return;
        }

        // Validate that we're connected to the host
        final SessionManager sessionManager = SessionManager.getInstance();
        final Optional<String> optionalHost = Stream
            .concat(sessionManager.getIncomingServers().stream(), sessionManager.getOutgoingServers().stream())
            .filter(remoteServerHost -> remoteServerHost.equalsIgnoreCase(host))
            .findAny();
        if (optionalHost.isEmpty()) {
            LOGGER.info("Request to unconnected host {} ignored - using default response", host);
            writeBytesToStream(defaultBytes, response);
            return;
        }

        // Check special cases where we need to change host to get a favicon
        final String hostToUse = "gmail.com".equals(host) ? "google.com" : host;
        byte[] bytes = getImage(hostToUse, defaultBytes);
        if (bytes != null) {
            writeBytesToStream(bytes, response);
        }
    }
Retrieve the image based on it's name.

@param request the httpservletrequest.
@param response the httpservletresponse.
xmppserver/src/main/java/org/jivesoftware/util/FaviconServlet.java