private static RequestHandler wrapHandlerIfFormPost(RequestHandler requestHandler,
                                                        Request request,
                                                        boolean removeBodyForFormPost) {
        if (!request.getMethod().equals("POST")) {
            return requestHandler;
        }
        String contentType = request.getHeaders().get(HttpHeaders.Names.CONTENT_TYPE);
        if (contentType == null) {
            return requestHandler;
        }
        if (!contentType.startsWith(APPLICATION_X_WWW_FORM_URLENCODED)) {
            return requestHandler;
        }
        return new FormPostRequestHandler(requestHandler, getCharsetName(contentType), removeBodyForFormPost);
    }
Implementation of a Jetty {@link Handler} that dispatches requests to JDisc's {@link com.yahoo.jdisc.handler.RequestHandler}.

@author bjorncs
container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JdiscDispatchingHandler.java