DWR????????Щ???????
???????????? ???????[ 2013/4/17 10:36:17 ] ????????
????????????????????ū?????γ?????η????????????????
??????????????????Щ???????????
????????post????
function getResult(script?? method?? paras){
var typelist = []
for(var i = 0; i < paras.length; i++){
typelist.push(typeof(paras[i]))
}
var result = "" + engine.getResult(script?? method?? paras?? typelist)
return result
}
..............
public String getResult(String ScriptName?? String MethodName?? Object[] args??
String[] argsTypes) throws Exception{
String posturl = http://xxxxxxxxxxxxxxxx/dwr/call/plaincall/ + ScriptName + MethodName +".dwr";
StringBuffer paramBuffer = new StringBuffer();
paramBuffer.append("callCount=1
scriptSessionId=${scriptSessionId}187
");
paramBuffer.append("c0-scriptName=").append(ScriptName).append("
c0-methodName=").append(MethodName);
paramBuffer.append("
c0-id=0");
for(int i=0;i<args.length;i++){
paramBuffer.append("
c0-param").append(i).append("=").append(argsTypes[i]).append(":").append(args[i]);
}
paramBuffer.append("
batchId=889209
");
return post(posturl?? paramBuffer.toString());
}
??????????????????????????js??????java???棬??sun.org.mozilla.javascript.internal.NativeObject??????????js?????????????java????
public static HashMap<String?? Object> getResult(String dwrString) throws Exception{
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
HashMap<String?? Object> retMap = new HashMap<String?? Object>();
engine.put("inputString"?? dwrString);
engine.put("map"?? retMap);
String jsScriptString = "" +
"var re = new RegExp("dwr.engine._remoteHandleCallback\\('\\d+'??'\\d+'??(.*?)\\);"?? "m")
" +
"var value = inputString.replace(re?? "var __result__ = $1")
" +
"eval(value)
" +
"for(var k in __result__) { map.put(k?? __result__[k])}";
engine.eval(jsScriptString);
return retMap;
}
public static void justtest(String testString) throws Exception{
HashMap<String?? Object> map = getResult(testString);
Double albumId = (Double) map.get("albumId");
System.out.println("albumId : " + albumId.intValue());
NativeObject album = (NativeObject) (map.get("album"));
System.out.println("album.createTime : " + album.get("createTime"?? null));
System.out.println("album.curl : " + album.get("curl"?? null));
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11