Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard.jetty;
 
 
An org.eclipse.jetty.server.handler.ErrorHandler subclass which doesn't identify itself as a Jetty server.
public class UnbrandedErrorHandler extends ErrorHandler {
    public UnbrandedErrorHandler() {
        super();
        setShowStacks(false);
    }
    @Override
    public void writeErrorPage(HttpServletRequest requestWriter writerint codeString messageboolean showStacksthrows IOException {
        super.writeErrorPage(requestwritercodemessageshowStacks);
    }
    @Override
    protected void writeErrorPageBody(HttpServletRequest requestWriter writerint codeString messageboolean showStacksthrows IOException {
        final String uri = request.getRequestURI();
        writeErrorPageMessage(requestwritercodemessageuri);
        if (showStacks) {
            writeErrorPageStacks(requestwriter);
        }
        for (int i= 0; i < 20; i++) {
            writer.write("<br/>                                                \n");
        }
    }
    public void writeValidationErrorPage(HttpServletRequest requestStringWriter writerInvalidEntityException exceptionthrows IOException {
        writer.write("<html>\n<head>\n");
        writeErrorPageHead(requestwriter, 422, "Unprocessable Entity");
        writer.write("</head>\n<body>");
        writeInvalidationErrorPageBody(request,
                                       writer,
                                       exception.getMessage(),
                                       exception.getErrors());
        writer.write("\n</body>\n</html>\n");
    }
    private void writeInvalidationErrorPageBody(HttpServletRequest requestStringWriter writerString messageImmutableList<Stringerrorsthrows IOException {
        final String uri = request.getRequestURI();
        writeErrorPageMessage(requestwriter, 422, "Unprocessable Entity"uri);
        writer.write("<h2>");
        write(writermessage);
        writer.write("</h2>");
        writer.write("<ul>");
        for (String error : errors) {
            writer.write("<li>");
            write(writererror);
            writer.write("</li>");
        }
        writer.write("</ul>");
    }
New to GrepCode? Check out our FAQ X