def url(pattern, order = 0):
    """
        Class Decorator: 设置路径匹配模式和排序序号

        1. 支持设置多个链接匹配规则。

        参数:
            pattern     链接正则匹配
            order       排序序号

        示例:
            @url(r"(?i)/(index.html?)?", 10)
            @url(r"(?i)/default.html?", 8)
            class IndexHandler(BaseHandler):
                pass
    """
    def actual(handler):
        if not isclass(handler) or not issubclass(handler, BaseHandler):
            raise Exception("must be BaseHandler's sub class.")

        if not hasattr(handler, "__urls__"): handler.__urls__ = []
        handler.__urls__.append((pattern, order))

        return handler

    return actual