Package net.lightbody.bmp.proxy

Examples of net.lightbody.bmp.proxy.FirefoxErrorContent


            return -1;
        }
    }

    private static void reportError(Exception e, URL url, HttpResponse response) {
        FirefoxErrorContent error = FirefoxErrorContent.GENERIC;
        if (e instanceof UnknownHostException) {
            error = FirefoxErrorContent.DNS_NOT_FOUND;
        } else if (e instanceof ConnectException) {
            error = FirefoxErrorContent.CONN_FAILURE;
        } else if (e instanceof ConnectTimeoutException) {
            error = FirefoxErrorContent.NET_TIMEOUT;
        } else if (e instanceof NoHttpResponseException) {
            error = FirefoxErrorContent.NET_RESET;
        } else if (e instanceof EOFException) {
            error = FirefoxErrorContent.NET_INTERRUPT;
        } else if (e instanceof IllegalArgumentException && e.getMessage().startsWith("Host name may not be null")){
            error = FirefoxErrorContent.DNS_NOT_FOUND;
        } else if (e instanceof BadURIException){
            error = FirefoxErrorContent.MALFORMED_URI;
        }

        String shortDesc = String.format(error.getShortDesc(), url.getHost());
        String text = String.format(FirefoxErrorConstants.ERROR_PAGE, error.getTitle(), shortDesc, error.getLongDesc());


        try {
            response.setStatus(HttpResponse.__502_Bad_Gateway);
            response.setContentLength(text.length());
View Full Code Here

TOP

Related Classes of net.lightbody.bmp.proxy.FirefoxErrorContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.