'Resolves URL paths to handler functions and casts the return value.'

@cp.expose
def default(self, *path, **data):

    cp.response.headers['Access-Control-Allow-Origin'] = self._xhr
    for (k, v) in g.items():
        data[k] = v
    try:
        v = self.router(path, **data)
    except RouteError:
        raise cp.HTTPError('404    Not    Found')
    except RateLimitForbidden:
        raise cp.HTTPError('403    Forbidden')
    except RateLimitExceeded:
        raise cp.HTTPError('429    Too    Many    Requests')
    except DatabaseError as e:
        raise cp.HTTPError('503    Service    Unavailable', message=str(e))
    except HTTPRedirect as e:
        raise cp.HTTPRedirect(e.url)
    except HTTPError as e:
        raise cp.HTTPError(e.status, message=e.message)
    v = self._cast(v)
    return v
