1 | sbool exposeMethods2_debug; |
2 | |
3 | static S exposeMethods2(O receiver, S s, L<S> methodNames) { |
4 | ret exposeMethods2(receiver, s, methodNames, null); |
5 | } |
6 | |
7 | static S exposeMethods2(O receiver, S s, L<S> methodNames, |
8 | Lock lock) { |
9 | new Matches m; |
10 | if (exposeMethods2_debug) print("Received: " + s); |
11 | if "call *" { |
12 | L l; |
13 | if (isIdentifier(m.unq(0))) |
14 | l = ll(m.unq(0)); |
15 | else |
16 | l = (L) unstructure(m.unq(0)); // we used to have safeUnstructure here |
17 | S method = getString(l, 0); |
18 | if (!contains(methodNames, method)) |
19 | fail("Method not allowed: " + method); |
20 | if (lock != null) lock.lock(); |
21 | try { |
22 | if (exposeMethods2_debug) print("Calling: " + method); |
23 | O o = call(receiver, method, asObjectArray(subList(l, 1))); |
24 | if (exposeMethods2_debug) print("Got: " + getClassName(o)); |
25 | ret ok2(structure(o)); |
26 | } finally { |
27 | if (lock != null) lock.unlock(); |
28 | } |
29 | } |
30 | if "list methods" |
31 | ret ok2(structure(methodNames)); |
32 | null; |
33 | } |
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: | 523 / 728 |
Version history: | 3 change(s) |
Referenced in: | [show references] |