@Override
public void dispatch() {
final HttpServletRequestImpl requestImpl = HttpServletRequestImpl.getRequestImpl(servletRequest);
final ServletPathMatch handler;
Deployment deployment = requestImpl.getServletContext().getDeployment();
if (servletRequest instanceof HttpServletRequest) {
handler = deployment.getServletPaths().getServletHandlerByPath(((HttpServletRequest) servletRequest).getServletPath());
} else {
handler = deployment.getServletPaths().getServletHandlerByPath(exchange.getRelativePath());
}
final HttpServerExchange exchange = requestImpl.getExchange();
exchange.putAttachment(HttpServletRequestImpl.DISPATCHER_TYPE_ATTACHMENT_KEY, DispatcherType.ASYNC);
exchange.putAttachment(HttpServletRequestImpl.ATTACHMENT_KEY, servletRequest);
exchange.putAttachment(HttpServletResponseImpl.ATTACHMENT_KEY, servletResponse);
dispatchAsyncRequest(deployment.getServletDispatcher(), handler, exchange);
}