當前位置: 首頁>>代碼示例>>Python>>正文


Python URLDecoder.split方法代碼示例

本文整理匯總了Python中java.net.URLDecoder.split方法的典型用法代碼示例。如果您正苦於以下問題:Python URLDecoder.split方法的具體用法?Python URLDecoder.split怎麽用?Python URLDecoder.split使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.URLDecoder的用法示例。


在下文中一共展示了URLDecoder.split方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handleImpl

# 需要導入模塊: from java.net import URLDecoder [as 別名]
# 或者: from java.net.URLDecoder import split [as 別名]
    def handleImpl(self, exchange, ibuff):
        r = ""
        try:
            uri = exchange.getRequestURI()
            command = uri.getPath().split("/")
            if not command[1] == "ajax":
                raise

            query = {}
            try:
                for x in uri.getRawQuery().split("&"):
                    x2 = URLDecoder().decode(x, "UTF-8")
                    k, v = x2.split("=", 1)
                    query[k] = v
            except:
                pass

            if command[2] == "webadmin":

                if command[3] == "stop":
                    q = QuestManager.getInstance().getQuest(WebAdmin.qn)
                    try:
                        q.cancelQuestTimers("webadmin_stop")
                        q.startQuestTimer("webadmin_stop", 1000, None, None)
                    except:
                        pass
                    r = "webAdmin stop"
                elif command[3] == "restart":
                    q = QuestManager.getInstance().getQuest(WebAdmin.qn)
                    try:
                        q.cancelQuestTimers("webadmin_restart")
                        q.startQuestTimer("webadmin_restart", 1000, None, None)
                    except:
                        pass
                    r = "webAdmin restart"
                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "quest":

                if command[3] == "list":
                    r2 = {}
                    for quest in QuestManager.getInstance().getAllManagedScripts():
                        qn = quest.getName()
                        r2[qn] = {}
                        if "req" in query:
                            for c in query["req"].split(","):
                                r2[qn][c] = self.getQuestInfo(c, quest)
                    r2 = r2.items()
                    r2.sort()
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "unload":
                    if not self.checkQuery(query, ["name"]):
                        raise
                    QuestManager.getInstance().getQuest(query["name"]).unload()

                elif command[3] == "reload":
                    if not self.checkQuery(query, ["name"]):
                        raise
                    QuestManager.getInstance().getQuest(query["name"]).reload()

                elif command[3] == "get_source":
                    if not self.checkQuery(query, ["name"]):
                        raise
                    file = QuestManager.getInstance().getQuest(query["name"]).getScriptFile()
                    try:
                        i = open(file.toString(), "r")
                    except:
                        exchange.sendResponseHeaders(404, 0)
                        return
                    r = i.read()
                    i.close()
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "text/plain; charset=utf-8")

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "script":
                if command[3] == "writefile_exec":
                    if not self.checkQuery(query, ["file"]):
                        raise
                    query["file"] = query["file"].replace("\\", "/")
                    query["file"] = query["file"].split("/")[-1]
                    path = sourcepath.replace("\\", "/") + "/custom/WebAdmin/WebRoot/temp/" + query["file"]
                    o = open(path, "w")
                    o.write(ibuff)
                    o.close()
                    file = File(path)
                    try:
                        L2ScriptEngineManager.getInstance().executeScript(file)
                    except ScriptException, e:
                        L2ScriptEngineManager.getInstance().reportScriptFileError(file, e)

                elif command[3] == "execjy":
#.........這裏部分代碼省略.........
開發者ID:gamer-lineage2,項目名稱:s4L2J,代碼行數:103,代碼來源:WebAdmin.py


注:本文中的java.net.URLDecoder.split方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。