sbool exposeMethods2_debug; static S exposeMethods2(O receiver, S s, L<S> methodNames) { ret exposeMethods2(receiver, s, methodNames, null); } static S exposeMethods2(O receiver, S s, L<S> methodNames, Lock lock) { new Matches m; if (exposeMethods2_debug) print("Received: " + s); if "call *" { L l; if (isIdentifier(m.unq(0))) l = ll(m.unq(0)); else l = (L) unstructure(m.unq(0)); // we used to have safeUnstructure here S method = getString(l, 0); if (!contains(methodNames, method)) fail("Method not allowed: " + method); if (lock != null) lock.lock(); try { if (exposeMethods2_debug) print("Calling: " + method); O o = call(receiver, method, asObjectArray(subList(l, 1))); if (exposeMethods2_debug) print("Got: " + getClassName(o)); ret ok2(structure(o)); } finally { if (lock != null) lock.unlock(); } } if "list methods" ret ok2(structure(methodNames)); null; }
Began life as a copy of #1004749
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
Snippet ID: | #1005744 |
Snippet name: | exposeMethods2 - expose methods of an object. only for trusted clients because of unstructure |
Eternal ID of this version: | #1005744/4 |
Text MD5: | 52a017eaf5034151a5337fca1c825ba4 |
Author: | stefan |
Category: | javax / rpc |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-24 16:51:42 |
Source code size: | 1005 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 524 / 729 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |