Changeset 15377 in project


Ignore:
Timestamp:
08/09/09 17:33:01 (10 years ago)
Author:
certainty
Message:

Changes applied for certainty (82.82.131.238) through svnwiki:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/uri-dispatch

    r15376 r15377  
    2020The dispatch-algorithm is implemented as follows:
    2121
     22('''Note''' Although not explicitly stated here the algorithm performs a whitelist-check on any procedure before it is invoked. See '''enable-checks''' and '''whitelist!''')
     23
    2224*  The path is empty. It checks if '''default-dispatch-target''' is non-false.
    2325   If it is, then it is invoked. If it is not '''dispatch-error''' is invoked.
     
    3133  in a module named by the first element. So if it sees (foo bar) it tries to find the procedure foo
    3234  inside the module bar. If the procedure exists it is invoked with the rest of the elements as arguments.
    33 **  If it does not exist, it interpretes the first element as the name of a procedure that was defined
     35** If it does not exist, it interpretes the first element as the name of a procedure that was defined
    3436  outside any module. If such a procedure exists, it is invoked passing the rest of the elements as arguments.
    35   If no such procedure exists '''dispatch-error''' is invoked with the full path as argument.
     37  If no such procedure exists '''dispatch-error''' is invoked with the full path as argument. The path is applied
     38  to the procedure so you can use for example dsssl-style lambdalists to declare optional arguments or a rest-argument.
     39
     40
     41<procedure>(whitelist! DEFINITION)</procedure>
     42Though nice for development it is not advisable to allow anybody out there to invoke abritary procedures of your application.
     43So you might want to '''enable-checks''' in production and whitelist only those modules and/or procedures you really want
     44to be callable from the outside. Whitelisting can be done with this procedure. It expects a list that defines the procedure/modules
     45you want to whitelist. You have basically three possibilities to perform whitelisting all of which can be combined.
     46
     471) whitelist procedures outside modules
     48<pre>(whitelist! '(procedure1 procedure2 procedure3))</pre>
     49
     502) whitelist all procedures inside a module
     51<pre>(whitelist! '((module my-module my-module2))</pre>
     52
     533) whitelist specific procedures inside a module
     54<pre>(whitelist! '((module-name procedure1 procedure2)))</pre>
     55
     56As noted above you can mix those possibilities
     57
     58<pre>(whitelist! '(proc1 proc2 proc3 (module foo-mod bar-mod) (baz-module proc4 proc5)))</pre>
     59
     60It is planned to implement some keywords that allow easier use of this procedure.
     61
     62
     63
     64<parameter>dispatch-error</parameter>
     65
     66If no handler for a uri can be found, the dispatcher will invoke the procedure that dispatch-error is currently parameterized with.
     67'''NOTE''' dispatch-error is also invoked if the requested handler exists but is not whitelisted.
     68
     69<parameter>enable-checks</parameter>
     70
     71<parameter>default-dispatch-target</parameter>
     72
     73<parameter>dispatch-environment</parameter>
    3674
    3775
Note: See TracChangeset for help on using the changeset viewer.