uri= StringUtil.replace(uri, "&", "&amp;");
    public static void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)        throws IOException    {        if (message != null)        {            message=URLDecoder.decode(message,"UTF-8");            message= StringUtil.replace(message, "<", "&lt;");            message= StringUtil.replace(message, "&", "&amp;");            message= StringUtil.replace(message, ">", "&gt;");        }        String uri= request.getRequestURI();        if (uri!=null)        {            uri= StringUtil.replace(uri, "<", "&lt;");            uri= StringUtil.replace(uri, "&", "&amp;");            uri= StringUtil.replace(uri, ">", "&gt;");        }                writer.write("<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"/>\n");        writer.write("<title>Error ");        writer.write(Integer.toString(code));        writer.write(' ');        if (message==null)            message=HttpGenerator.getReason(code);        writer.write(message);        writer.write("</title>\n</head>\n<body>\n<h2>HTTP ERROR: ");        writer.write(Integer.toString(code));        writer.write("</h2><pre>");        writer.write(message);        writer.write("</pre>\n");        writer.write("<p>RequestURI=");        writer.write(uri);        writer.write(            "</p>\n<p><i><small><a href=\"http://jetty.mortbay.org\">Powered by Jetty://</a></small></i></p>");                if (showStacks)        {            Throwable th = (Throwable)request.getAttribute("javax.servlet.error.exception");            while(th!=null)            {                writer.write("<h3>Caused by:</h3><pre>");                StringWriter sw = new StringWriter();                PrintWriter pw = new PrintWriter(sw);                th.printStackTrace(pw);                pw.flush();                writer.write(sw.getBuffer().toString());                writer.write("</pre>\n");                                th =th.getCause();            }        }                for (int i= 0; i < 20; i++)            writer.write("\n                                                ");        writer.write("\n</body>\n</html>\n");    }