'This gets called from render() every time someone sends us a request.
This checks if anyone has registered a callback for that method and
path.'

@request_handler(include_metrics=True)
@defer.inlineCallbacks
def _async_render(self, request, request_metrics):

    if (request.method == 'OPTIONS'):
        self._send_response(request, 200, {})
        return
    for path_entry in self.path_regexs.get(request.method, []):
        m = path_entry.pattern.match(request.path)
        if (not m):
            continue
        callback = path_entry.callback
        kwargs = intern_dict({name: (urllib.unquote(value).decode('UTF-8') if value else value) for (name, value) in m.groupdict().items()})
        callback_return = (yield callback(request, **kwargs))
        if (callback_return is not None):
            (code, response) = callback_return
            self._send_response(request, code, response)
        servlet_instance = getattr(callback, '__self__', None)
        if (servlet_instance is not None):
            servlet_classname = servlet_instance.__class__.__name__
        else:
            servlet_classname = ('%r' % callback)
        request_metrics.name = servlet_classname
        return
    raise UnrecognizedRequestError()
