本文整理汇总了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":
#.........这里部分代码省略.........