Artifact
9bca568ff5a18a127a70858df74f216289653908:
Wiki page
[(data uri)] by
murphy
2016-06-02 13:01:18.
0000: 44 20 32 30 31 36 2d 30 36 2d 30 32 54 31 33 3a D 2016-06-02T13:
0010: 30 31 3a 31 38 2e 33 31 34 0a 4c 20 28 64 61 74 01:18.314.L (dat
0020: 61 5c 73 75 72 69 29 0a 50 20 61 34 63 31 61 32 a\suri).P a4c1a2
0030: 62 39 61 33 32 63 65 63 65 30 30 31 30 31 38 39 b9a32cece0010189
0040: 65 35 33 32 30 37 37 37 36 65 36 32 31 65 65 61 e53207776e621eea
0050: 37 65 0a 55 20 6d 75 72 70 68 79 0a 57 20 34 32 7e.U murphy.W 42
0060: 30 34 0a 3c 68 31 3e 55 52 49 20 48 61 6e 64 6c 04.<h1>URI Handl
0070: 69 6e 67 3c 2f 68 31 3e 0d 0a 0d 0a 3c 68 32 3e ing</h1>....<h2>
0080: 53 79 6e 6f 70 73 69 73 3c 2f 68 32 3e 0d 0a 0d Synopsis</h2>...
0090: 0a 3c 63 6f 64 65 3e 28 69 6d 70 6f 72 74 20 28 .<code>(import (
00a0: 64 61 74 61 20 75 72 69 29 29 3c 2f 63 6f 64 65 data uri))</code
00b0: 3e 0d 0a 0d 0a 45 6e 63 6f 64 65 20 64 61 74 61 >....Encode data
00c0: 20 66 6f 72 20 69 6e 63 6c 75 73 69 6f 6e 20 69 for inclusion i
00d0: 6e 20 61 20 5b 68 74 74 70 73 3a 2f 2f 65 6e 2e n a [https://en.
00e0: 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69 wikipedia.org/wi
00f0: 6b 69 2f 55 6e 69 66 6f 72 6d 5f 52 65 73 6f 75 ki/Uniform_Resou
0100: 72 63 65 5f 49 64 65 6e 74 69 66 69 65 72 7c 75 rce_Identifier|u
0110: 6e 69 66 6f 72 6d 20 72 65 73 6f 75 72 63 65 20 niform resource
0120: 69 64 65 6e 74 69 66 69 65 72 5d 20 6f 72 20 69 identifier] or i
0130: 6e 74 65 72 70 72 65 74 20 69 74 2e 0d 0a 0d 0a nterpret it.....
0140: 3c 68 32 3e 45 6e 63 6f 64 69 6e 67 3c 2f 68 32 <h2>Encoding</h2
0150: 3e 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 >....<h3>procedu
0160: 72 65 3a 20 3c 63 6f 64 65 3e 28 75 72 69 2d 65 re: <code>(uri-e
0170: 6e 63 6f 64 65 20 3c 69 3e 73 74 72 69 6e 67 3c ncode <i>string<
0180: 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e /i>)</code></h3>
0190: 0d 0a 0d 0a 52 65 70 6c 61 63 65 20 63 68 61 72 ....Replace char
01a0: 61 63 74 65 72 73 20 69 6e 20 74 68 65 20 67 69 acters in the gi
01b0: 76 65 6e 20 73 74 72 69 6e 67 20 62 79 20 68 65 ven string by he
01c0: 78 61 64 65 63 69 6d 61 6c 20 65 73 63 61 70 65 xadecimal escape
01d0: 20 73 65 71 75 65 6e 63 65 73 2e 20 41 6c 70 68 sequences. Alph
01e0: 61 62 65 74 69 63 20 61 6e 64 20 6e 75 6d 65 72 abetic and numer
01f0: 69 63 20 63 68 61 72 61 63 74 65 72 73 20 61 73 ic characters as
0200: 20 77 65 6c 6c 20 61 73 20 22 2d 22 2c 20 22 7e well as "-", "~
0210: 22 2c 20 22 2e 22 20 61 6e 64 20 22 5f 22 20 61 ", "." and "_" a
0220: 72 65 20 6c 65 66 74 20 75 6e 65 73 63 61 70 65 re left unescape
0230: 64 2e 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 d.....<h3>proced
0240: 75 72 65 3a 20 3c 63 6f 64 65 3e 28 75 72 69 2d ure: <code>(uri-
0250: 64 65 63 6f 64 65 20 3c 69 3e 73 74 72 69 6e 67 decode <i>string
0260: 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 </i>)</code></h3
0270: 3e 0d 0a 0d 0a 52 65 70 6c 61 63 65 73 20 22 2b >....Replaces "+
0280: 22 20 63 68 61 72 61 63 74 65 72 73 20 62 79 20 " characters by
0290: 73 70 61 63 65 73 20 61 6e 64 20 68 65 78 61 64 spaces and hexad
02a0: 65 63 69 6d 61 6c 20 65 73 63 61 70 65 20 73 65 ecimal escape se
02b0: 71 75 65 6e 63 65 73 20 62 79 20 74 68 65 69 72 quences by their
02c0: 20 63 68 61 72 61 63 74 65 72 20 65 71 75 69 76 character equiv
02d0: 61 6c 65 6e 74 73 20 69 6e 20 74 68 65 20 67 69 alents in the gi
02e0: 76 65 6e 20 73 74 72 69 6e 67 2e 0d 0a 0d 0a 3c ven string.....<
02f0: 68 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 h3>procedure: <c
0300: 6f 64 65 3e 28 75 72 69 2d 65 6e 63 6f 64 65 2d ode>(uri-encode-
0310: 71 75 65 72 79 20 3c 69 3e 61 6c 69 73 74 3c 2f query <i>alist</
0320: 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d i>)</code></h3>.
0330: 0a 0d 0a 45 6e 63 6f 64 65 73 20 61 6e 20 61 73 ...Encodes an as
0340: 73 6f 63 69 61 74 69 6f 6e 20 6c 69 73 74 20 77 sociation list w
0350: 69 74 68 20 73 74 72 69 6e 67 20 6b 65 79 73 20 ith string keys
0360: 61 6e 64 20 76 61 6c 75 65 73 20 69 6e 74 6f 20 and values into
0370: 61 20 71 75 65 72 79 20 73 74 72 69 6e 67 20 74 a query string t
0380: 68 61 74 20 6d 61 79 20 62 65 20 69 6e 63 6c 75 hat may be inclu
0390: 64 65 64 20 69 6e 20 61 20 55 52 49 2e 20 54 68 ded in a URI. Th
03a0: 65 20 6b 65 79 73 20 61 6e 64 20 76 61 6c 75 65 e keys and value
03b0: 73 20 61 72 65 20 70 61 73 73 65 64 20 74 68 72 s are passed thr
03c0: 6f 75 67 68 20 3c 74 74 3e 75 72 69 2d 65 6e 63 ough <tt>uri-enc
03d0: 6f 64 65 3c 2f 74 74 3e 2e 0d 0a 0d 0a 3c 68 33 ode</tt>.....<h3
03e0: 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 >procedure: <cod
03f0: 65 3e 28 75 72 69 2d 64 65 63 6f 64 65 2d 71 75 e>(uri-decode-qu
0400: 65 72 79 20 3c 69 3e 73 74 72 69 6e 67 3c 2f 69 ery <i>string</i
0410: 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a >)</code></h3>..
0420: 0d 0a 44 65 63 6f 64 65 73 20 61 20 71 75 65 72 ..Decodes a quer
0430: 79 20 73 74 72 69 6e 67 20 66 6f 75 6e 64 20 69 y string found i
0440: 6e 20 61 20 55 52 49 20 69 6e 74 6f 20 61 6e 20 n a URI into an
0450: 61 73 73 6f 63 69 61 74 69 6f 6e 20 6c 69 73 74 association list
0460: 20 77 69 74 68 20 73 74 72 69 6e 67 20 6b 65 79 with string key
0470: 73 20 61 6e 64 20 76 61 6c 75 65 73 2e 20 54 68 s and values. Th
0480: 65 20 6b 65 79 73 20 61 6e 64 20 76 61 6c 75 65 e keys and value
0490: 73 20 61 72 65 20 70 61 73 73 65 64 20 74 68 72 s are passed thr
04a0: 6f 75 67 68 20 3c 74 74 3e 75 72 69 2d 64 65 63 ough <tt>uri-dec
04b0: 6f 64 65 3c 2f 74 74 3e 2e 0d 0a 0d 0a 3c 68 33 ode</tt>.....<h3
04c0: 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 >procedure: <cod
04d0: 65 3e 28 75 72 69 2d 65 6e 63 6f 64 65 2d 70 61 e>(uri-encode-pa
04e0: 74 68 26 71 75 65 72 79 20 3c 69 3e 69 74 65 6d th&query <i>item
04f0: 73 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 s</i>)</code></h
0500: 33 3e 0d 0a 0d 0a 4a 6f 69 6e 73 20 61 20 6c 69 3>....Joins a li
0510: 73 74 20 6f 66 20 70 61 74 68 20 6e 61 6d 65 73 st of path names
0520: 20 77 69 74 68 20 61 6e 20 6f 70 74 69 6f 6e 61 with an optiona
0530: 6c 20 71 75 65 72 79 20 61 6c 69 73 74 20 74 61 l query alist ta
0540: 69 6c 20 69 6e 74 6f 20 61 20 55 52 49 20 70 61 il into a URI pa
0550: 74 68 20 73 74 72 69 6e 67 2e 0d 0a 0d 0a 3c 68 th string.....<h
0560: 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 3>procedure: <co
0570: 64 65 3e 28 75 72 69 2d 64 65 63 6f 64 65 2d 70 de>(uri-decode-p
0580: 61 74 68 26 71 75 65 72 79 20 3c 69 3e 70 61 74 ath&query <i>pat
0590: 68 26 71 75 65 72 79 3c 2f 69 3e 29 3c 2f 63 6f h&query</i>)</co
05a0: 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 53 70 6c 69 de></h3>....Spli
05b0: 74 73 20 61 20 72 65 6c 61 74 69 76 65 20 55 52 ts a relative UR
05c0: 49 20 69 6e 74 6f 20 61 20 6c 69 73 74 20 6f 66 I into a list of
05d0: 20 70 61 74 68 20 6e 61 6d 65 73 20 77 69 74 68 path names with
05e0: 20 61 6e 20 6f 70 74 69 6f 6e 61 6c 20 71 75 65 an optional que
05f0: 72 79 20 61 6c 69 73 74 20 74 61 69 6c 2e 0d 0a ry alist tail...
0600: 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a ..<h3>procedure:
0610: 20 3c 63 6f 64 65 3e 28 6d 61 6b 65 2d 64 61 74 <code>(make-dat
0620: 61 2d 75 72 69 20 3c 69 3e 64 61 74 61 3c 2f 69 a-uri <i>data</i
0630: 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a >)</code></h3>..
0640: 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c <h3>procedure: <
0650: 63 6f 64 65 3e 28 6d 61 6b 65 2d 64 61 74 61 2d code>(make-data-
0660: 75 72 69 20 3c 69 3e 64 61 74 61 3c 2f 69 3e 20 uri <i>data</i>
0670: 3c 69 3e 74 79 70 65 3c 2f 69 3e 29 3c 2f 63 6f <i>type</i>)</co
0680: 64 65 3e 3c 2f 68 33 3e 0d 0a 3c 68 33 3e 70 72 de></h3>..<h3>pr
0690: 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 65 3e 28 ocedure: <code>(
06a0: 6d 61 6b 65 2d 64 61 74 61 2d 75 72 69 20 3c 69 make-data-uri <i
06b0: 3e 64 61 74 61 3c 2f 69 3e 20 3c 69 3e 74 79 70 >data</i> <i>typ
06c0: 65 3c 2f 69 3e 20 3c 69 3e 63 68 61 72 73 65 74 e</i> <i>charset
06d0: 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 </i>)</code></h3
06e0: 3e 0d 0a 0d 0a 45 6e 63 6f 64 65 73 20 74 68 65 >....Encodes the
06f0: 20 73 74 72 69 6e 67 20 6f 72 20 62 79 74 65 76 string or bytev
0700: 65 63 74 6f 72 20 3c 69 3e 64 61 74 61 3c 2f 69 ector <i>data</i
0710: 3e 20 61 73 20 61 20 5b 68 74 74 70 73 3a 2f 2f > as a [https://
0720: 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 en.wikipedia.org
0730: 2f 77 69 6b 69 2f 44 61 74 61 5f 55 52 49 5f 73 /wiki/Data_URI_s
0740: 63 68 65 6d 65 7c 44 61 74 61 20 55 52 49 5d 2e cheme|Data URI].
0750: 20 54 68 65 20 6d 65 64 69 61 20 3c 69 3e 74 79 The media <i>ty
0760: 70 65 3c 2f 69 3e 20 6f 66 20 74 68 65 20 64 61 pe</i> of the da
0770: 74 61 20 64 65 66 61 75 6c 74 73 20 74 6f 20 22 ta defaults to "
0780: 74 65 78 74 2f 70 6c 61 69 6e 22 20 66 6f 72 20 text/plain" for
0790: 73 74 72 69 6e 67 20 61 6e 64 20 22 61 70 70 6c string and "appl
07a0: 69 63 61 74 69 6f 6e 2f 6f 63 74 65 74 2d 73 74 ication/octet-st
07b0: 72 65 61 6d 22 20 66 6f 72 20 62 79 74 65 76 65 ream" for byteve
07c0: 63 74 6f 72 73 2e 20 49 66 20 6e 6f 20 3c 69 3e ctors. If no <i>
07d0: 63 68 61 72 73 65 74 3c 2f 69 3e 20 69 73 20 73 charset</i> is s
07e0: 70 65 63 69 66 69 65 64 20 65 78 70 6c 69 63 69 pecified explici
07f0: 74 6c 79 2c 20 73 74 72 69 6e 67 73 20 61 72 65 tly, strings are
0800: 20 70 61 73 73 65 64 20 74 68 72 6f 75 67 68 20 passed through
0810: 3c 74 74 3e 75 72 69 2d 65 6e 63 6f 64 65 3c 2f <tt>uri-encode</
0820: 74 74 3e 20 61 6e 64 20 62 79 74 65 76 65 63 74 tt> and bytevect
0830: 6f 72 73 20 61 72 65 20 70 61 73 73 65 64 20 74 ors are passed t
0840: 68 72 6f 75 67 68 20 3c 74 74 3e 62 61 73 65 36 hrough <tt>base6
0850: 34 2d 65 6e 63 6f 64 65 3c 2f 74 74 3e 20 66 6f 4-encode</tt> fo
0860: 72 20 69 6e 63 6c 75 73 69 6f 6e 20 69 6e 20 74 r inclusion in t
0870: 68 65 20 55 52 49 2e 20 49 66 20 61 20 63 68 61 he URI. If a cha
0880: 72 73 65 74 20 69 73 20 73 70 65 63 69 66 69 65 rset is specifie
0890: 64 2c 20 73 74 72 69 6e 67 73 20 61 72 65 20 63 d, strings are c
08a0: 6f 6e 76 65 72 74 65 64 20 69 6e 74 6f 20 74 68 onverted into th
08b0: 61 74 20 65 6e 63 6f 64 69 6e 67 20 61 6e 64 20 at encoding and
08c0: 74 68 65 20 72 65 73 75 6c 74 20 69 73 20 70 61 the result is pa
08d0: 73 73 65 64 20 74 68 72 6f 75 67 68 20 3c 74 74 ssed through <tt
08e0: 3e 62 61 73 65 36 34 2d 65 6e 63 6f 64 65 3c 2f >base64-encode</
08f0: 74 74 3e 2c 20 74 6f 6f 2e 0d 0a 0d 0a 3c 68 32 tt>, too.....<h2
0900: 3e 44 69 73 70 61 74 63 68 69 6e 67 3c 2f 68 32 >Dispatching</h2
0910: 3e 0d 0a 0d 0a 3c 68 33 3e 72 65 63 6f 72 64 3a >....<h3>record:
0920: 20 3c 63 6f 64 65 3e 72 65 73 6f 75 72 63 65 3c <code>resource<
0930: 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 3c 68 33 /code></h3>..<h3
0940: 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 >procedure: <cod
0950: 65 3e 28 72 65 73 6f 75 72 63 65 3f 20 3c 69 3e e>(resource? <i>
0960: 61 6e 79 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c any</i>)</code><
0970: 2f 68 33 3e 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 /h3>..<h3>proced
0980: 75 72 65 3a 20 3c 63 6f 64 65 3e 28 6d 61 6b 65 ure: <code>(make
0990: 2d 72 65 73 6f 75 72 63 65 20 3c 69 3e 6d 65 74 -resource <i>met
09a0: 68 6f 64 3c 2f 69 3e 20 3c 69 3e 70 61 74 68 26 hod</i> <i>path&
09b0: 71 75 65 72 79 3c 2f 69 3e 20 3c 69 3e 68 61 6e query</i> <i>han
09c0: 64 6c 65 72 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e dler</i>)</code>
09d0: 3c 2f 68 33 3e 0d 0a 3c 68 33 3e 70 72 6f 63 65 </h3>..<h3>proce
09e0: 64 75 72 65 3a 20 3c 63 6f 64 65 3e 28 72 65 73 dure: <code>(res
09f0: 6f 75 72 63 65 2d 6d 65 74 68 6f 64 20 3c 69 3e ource-method <i>
0a00: 72 65 73 6f 75 72 63 65 3c 2f 69 3e 29 3c 2f 63 resource</i>)</c
0a10: 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 3c 68 33 3e 70 ode></h3>..<h3>p
0a20: 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 65 3e rocedure: <code>
0a30: 28 72 65 73 6f 75 72 63 65 2d 70 61 74 68 26 71 (resource-path&q
0a40: 75 65 72 79 20 3c 69 3e 72 65 73 6f 75 72 63 65 uery <i>resource
0a50: 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 </i>)</code></h3
0a60: 3e 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 >..<h3>procedure
0a70: 3a 20 3c 63 6f 64 65 3e 28 72 65 73 6f 75 72 63 : <code>(resourc
0a80: 65 2d 68 61 6e 64 6c 65 72 20 3c 69 3e 72 65 73 e-handler <i>res
0a90: 6f 75 72 63 65 3c 2f 69 3e 29 3c 2f 63 6f 64 65 ource</i>)</code
0aa0: 3e 3c 2f 68 33 3e 0d 0a 0d 0a 41 20 72 65 63 6f ></h3>....A reco
0ab0: 72 64 20 74 79 70 65 20 74 6f 20 73 74 6f 72 65 rd type to store
0ac0: 20 61 20 72 65 71 75 65 73 74 20 6d 65 74 68 6f a request metho
0ad0: 64 2c 20 70 61 74 68 20 61 6e 64 20 71 75 65 72 d, path and quer
0ae0: 79 20 70 61 72 61 6d 65 74 65 72 20 70 61 74 74 y parameter patt
0af0: 65 72 6e 20 61 6e 64 20 68 61 6e 64 6c 65 72 20 ern and handler
0b00: 70 72 6f 63 65 64 75 72 65 2e 0d 0a 0d 0a 54 68 procedure.....Th
0b10: 65 20 70 61 74 68 20 61 6e 64 20 71 75 65 72 79 e path and query
0b20: 20 64 61 74 61 20 73 68 6f 75 6c 64 20 62 65 20 data should be
0b30: 61 20 6c 69 73 74 20 6c 69 6b 65 20 66 6f 72 20 a list like for
0b40: 3c 74 74 3e 75 72 69 2d 65 6e 63 6f 64 65 2d 70 <tt>uri-encode-p
0b50: 61 74 68 26 71 75 65 72 79 3c 2f 74 74 3e 2c 20 ath&query</tt>,
0b60: 62 75 74 20 69 74 20 6d 61 79 20 69 6e 63 6c 75 but it may inclu
0b70: 64 65 20 74 68 65 20 73 79 6d 62 6f 6c 73 20 3c de the symbols <
0b80: 74 74 3e 24 3c 2f 74 74 3e 20 6f 72 20 3c 74 74 tt>$</tt> or <tt
0b90: 3e 2e 2e 2e 3c 2f 74 74 3e 20 74 6f 20 69 6e 64 >...</tt> to ind
0ba0: 69 63 61 74 65 20 61 20 73 69 6e 67 6c 65 20 66 icate a single f
0bb0: 72 65 65 20 70 61 72 61 6d 65 74 65 72 20 6f 72 ree parameter or
0bc0: 20 61 6e 79 20 6e 75 6d 62 65 72 20 6f 66 20 66 any number of f
0bd0: 72 65 65 20 70 61 72 61 6d 65 74 65 72 73 2e 0d ree parameters..
0be0: 0a 0d 0a 3c 74 74 3e 6d 61 6b 65 2d 72 65 73 6f ...<tt>make-reso
0bf0: 75 72 63 65 3c 2f 74 74 3e 20 61 63 63 65 70 74 urce</tt> accept
0c00: 73 20 73 74 72 69 6e 67 73 20 69 6e 20 70 6c 61 s strings in pla
0c10: 63 65 20 6f 66 20 61 20 70 61 74 68 20 61 6e 64 ce of a path and
0c20: 20 71 75 65 72 79 20 6c 69 73 74 2c 20 77 68 69 query list, whi
0c30: 63 68 20 61 72 65 20 70 61 72 73 65 64 20 75 73 ch are parsed us
0c40: 69 6e 67 20 3c 74 74 3e 75 72 69 2d 64 65 63 6f ing <tt>uri-deco
0c50: 64 65 2d 70 61 74 68 26 71 75 65 72 79 3c 2f 74 de-path&query</t
0c60: 74 3e 20 61 6e 64 20 6d 61 79 20 63 6f 6e 74 61 t> and may conta
0c70: 69 6e 20 74 68 65 20 70 6c 61 63 65 68 6f 6c 64 in the placehold
0c80: 65 72 73 20 3c 74 74 3e 7b 7d 3c 2f 74 74 3e 20 ers <tt>{}</tt>
0c90: 6f 72 20 3c 74 74 3e 7b 2e 2e 2e 7d 3c 2f 74 74 or <tt>{...}</tt
0ca0: 3e 20 77 68 65 72 65 20 74 68 65 20 73 79 6d 62 > where the symb
0cb0: 6f 6c 73 20 3c 74 74 3e 24 3c 2f 74 74 3e 20 6f ols <tt>$</tt> o
0cc0: 72 20 3c 74 74 3e 2e 2e 2e 3c 2f 74 74 3e 20 73 r <tt>...</tt> s
0cd0: 68 6f 75 6c 64 20 61 70 70 65 61 72 20 69 6e 20 hould appear in
0ce0: 74 68 65 20 6c 69 73 74 2e 0d 0a 0d 0a 3c 68 33 the list.....<h3
0cf0: 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 >procedure: <cod
0d00: 65 3e 28 72 65 73 6f 75 72 63 65 2d 75 72 69 20 e>(resource-uri
0d10: 3c 69 3e 72 65 73 6f 75 72 63 65 3c 2f 69 3e 20 <i>resource</i>
0d20: 3c 69 3e 70 61 72 61 6d 65 74 65 72 3c 2f 69 3e <i>parameter</i>
0d30: 20 2e 2e 2e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 ...)</code></h3
0d40: 3e 0d 0a 0d 0a 52 65 70 6c 61 63 65 73 20 74 68 >....Replaces th
0d50: 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 20 69 e placeholders i
0d60: 6e 20 74 68 65 20 3c 74 74 3e 72 65 73 6f 75 72 n the <tt>resour
0d70: 63 65 2d 70 61 74 68 26 71 75 65 72 79 3c 2f 74 ce-path&query</t
0d80: 74 3e 20 77 69 74 68 20 74 68 65 20 67 69 76 65 t> with the give
0d90: 6e 20 70 61 72 61 6d 65 74 65 72 73 20 61 6e 64 n parameters and
0da0: 20 72 65 74 75 72 6e 73 20 61 20 73 74 72 69 6e returns a strin
0db0: 67 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 g representing t
0dc0: 68 65 20 72 65 73 75 6c 74 69 6e 67 20 55 52 49 he resulting URI
0dd0: 2e 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 .....<h3>procedu
0de0: 72 65 3a 20 3c 63 6f 64 65 3e 28 72 65 73 6f 75 re: <code>(resou
0df0: 72 63 65 2d 61 70 70 6c 79 20 3c 69 3e 72 65 73 rce-apply <i>res
0e00: 6f 75 72 63 65 3c 2f 69 3e 20 3c 69 3e 70 61 74 ource</i> <i>pat
0e10: 68 26 71 75 65 72 79 3c 2f 69 3e 29 3c 2f 63 6f h&query</i>)</co
0e20: 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 45 78 74 72 de></h3>....Extr
0e30: 61 63 74 73 20 74 68 65 20 76 61 6c 75 65 73 20 acts the values
0e40: 66 6f 72 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 for placeholder
0e50: 76 61 72 69 61 62 6c 65 73 20 66 72 6f 6d 20 74 variables from t
0e60: 68 65 20 67 69 76 65 6e 20 70 61 74 68 20 61 6e he given path an
0e70: 64 20 71 75 65 72 79 20 6c 69 73 74 20 6f 72 20 d query list or
0e80: 73 74 72 69 6e 67 20 61 6e 64 20 61 70 70 6c 69 string and appli
0e90: 65 73 20 74 68 65 20 3c 74 74 3e 72 65 73 6f 75 es the <tt>resou
0ea0: 72 63 65 2d 68 61 6e 64 6c 65 72 3c 2f 74 74 3e rce-handler</tt>
0eb0: 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 69 6e to the resultin
0ec0: 67 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 2e g argument list.
0ed0: 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 ....<h3>procedur
0ee0: 65 3a 20 3c 63 6f 64 65 3e 28 28 72 65 73 6f 75 e: <code>((resou
0ef0: 72 63 65 2d 64 69 73 70 61 74 63 68 20 3c 69 3e rce-dispatch <i>
0f00: 64 65 66 61 75 6c 74 3c 2f 69 3e 20 3c 69 3e 72 default</i> <i>r
0f10: 65 73 6f 75 72 63 65 3c 2f 69 3e 20 2e 2e 2e 29 esource</i> ...)
0f20: 20 3c 69 3e 6d 65 74 68 6f 64 3c 2f 69 3e 20 3c <i>method</i> <
0f30: 69 3e 70 61 74 68 26 71 75 65 72 79 3c 2f 69 3e i>path&query</i>
0f40: 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d )</code></h3>...
0f50: 0a 43 72 65 61 74 65 73 20 61 20 64 69 73 70 61 .Creates a dispa
0f60: 74 63 68 20 70 72 6f 63 65 64 75 72 65 20 74 68 tch procedure th
0f70: 61 74 20 73 65 6c 65 63 74 73 20 61 20 75 6e 69 at selects a uni
0f80: 71 75 65 20 6d 61 74 63 68 69 6e 67 20 72 65 73 que matching res
0f90: 6f 75 72 63 65 20 62 61 73 65 64 20 6f 6e 20 74 ource based on t
0fa0: 68 65 20 70 61 74 68 20 61 6e 64 20 71 75 65 72 he path and quer
0fb0: 79 20 70 61 74 74 65 72 6e 73 20 61 73 20 77 65 y patterns as we
0fc0: 6c 6c 20 61 73 20 74 68 65 20 6d 65 74 68 6f 64 ll as the method
0fd0: 2e 20 49 66 20 6e 6f 20 72 65 73 6f 75 72 63 65 . If no resource
0fe0: 20 6d 61 74 63 68 65 73 2c 20 74 68 65 20 64 65 matches, the de
0ff0: 66 61 75 6c 74 20 70 72 6f 63 65 64 75 72 65 20 fault procedure
1000: 69 73 20 63 61 6c 6c 65 64 20 69 6e 73 74 65 61 is called instea
1010: 64 20 6f 66 20 61 20 72 65 73 6f 75 72 63 65 20 d of a resource
1020: 68 61 6e 64 6c 65 72 2e 0d 0a 0d 0a 4e 6f 74 65 handler.....Note
1030: 20 74 68 61 74 20 74 68 65 20 6f 72 64 65 72 20 that the order
1040: 6f 66 20 66 69 78 65 64 20 6e 61 6d 65 64 20 70 of fixed named p
1050: 61 72 61 6d 65 74 65 72 73 20 69 73 20 72 65 6c arameters is rel
1060: 65 76 61 6e 74 20 64 75 72 69 6e 67 20 64 69 73 evant during dis
1070: 70 61 74 63 68 2c 20 73 6f 20 69 74 20 6d 61 79 patch, so it may
1080: 20 6d 61 6b 65 20 73 65 6e 73 65 20 74 6f 20 69 make sense to i
1090: 6e 63 6c 75 64 65 20 61 74 20 6d 6f 73 74 20 6f nclude at most o
10a0: 6e 65 20 73 75 63 68 20 70 61 72 61 6d 65 74 65 ne such paramete
10b0: 72 20 69 6e 20 61 20 70 61 74 68 20 61 6e 20 71 r in a path an q
10c0: 75 65 72 79 20 70 61 74 74 65 72 6e 2e 0d 0a 0a uery pattern....
10d0: 5a 20 33 37 64 32 61 34 38 37 37 30 37 66 33 63 Z 37d2a487707f3c
10e0: 31 65 30 30 63 31 37 31 35 32 39 37 63 33 31 32 1e00c1715297c312
10f0: 31 39 0a 19.