WebGate

Hex Artifact Content
Login

Artifact 623bf6fbe534da1e68ba035d94fa0d95104a9275:

Wiki page [Interpreting Parameters] by murphy 2013-05-30 16:56:37.
0000: 44 20 32 30 31 33 2d 30 35 2d 33 30 54 31 36 3a  D 2013-05-30T16:
0010: 35 36 3a 33 37 2e 38 35 32 0a 4c 20 49 6e 74 65  56:37.852.L Inte
0020: 72 70 72 65 74 69 6e 67 5c 73 50 61 72 61 6d 65  rpreting\sParame
0030: 74 65 72 73 0a 50 20 38 64 36 32 65 64 63 61 38  ters.P 8d62edca8
0040: 31 65 66 39 63 39 35 33 64 61 63 64 37 34 39 34  1ef9c953dacd7494
0050: 33 64 33 65 34 63 38 33 31 34 37 32 61 61 36 0a  3d3e4c831472aa6.
0060: 55 20 6d 75 72 70 68 79 0a 57 20 31 33 31 30 0a  U murphy.W 1310.
0070: 3c 68 31 3e 49 6e 74 65 72 70 72 65 74 69 6e 67  <h1>Interpreting
0080: 20 50 61 72 61 6d 65 74 65 72 73 3c 2f 68 31 3e   Parameters</h1>
0090: 0d 0a 0d 0a 57 65 62 47 61 74 65 20 72 65 70 72  ....WebGate repr
00a0: 65 73 65 6e 74 73 20 72 65 71 75 65 73 74 20 70  esents request p
00b0: 61 72 61 6d 65 74 65 72 73 20 61 73 20 61 20 68  arameters as a h
00c0: 61 73 68 20 74 61 62 6c 65 20 77 69 74 68 20 73  ash table with s
00d0: 74 72 69 6e 67 20 6b 65 79 73 20 61 6e 64 20 70  tring keys and p
00e0: 61 73 73 65 73 20 74 68 65 6d 20 74 6f 20 74 68  asses them to th
00f0: 65 20 72 65 73 6f 75 72 63 65 20 68 61 6e 64 6c  e resource handl
0100: 65 72 20 61 73 20 69 74 73 20 6c 61 73 74 20 61  er as its last a
0110: 72 67 75 6d 65 6e 74 2e 20 48 6f 77 65 76 65 72  rgument. However
0120: 2c 20 73 6f 6d 65 20 72 65 71 75 65 73 74 73 20  , some requests 
0130: 63 6f 6e 74 61 69 6e 20 63 6f 6d 70 6c 65 78 20  contain complex 
0140: 70 61 72 61 6d 65 74 65 72 73 20 77 69 74 68 20  parameters with 
0150: 74 79 70 65 20 61 6e 64 20 68 65 61 64 65 72 20  type and header 
0160: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 6e 64 20  information and 
0170: 61 6e 79 20 72 65 71 75 65 73 74 20 70 61 72 61  any request para
0180: 6d 65 74 65 72 20 63 61 6e 20 6f 63 63 75 72 20  meter can occur 
0190: 6d 75 6c 74 69 70 6c 65 20 74 69 6d 65 73 20 77  multiple times w
01a0: 69 74 68 20 64 69 66 66 65 72 65 6e 74 20 76 61  ith different va
01b0: 6c 75 65 73 2c 20 68 65 6e 63 65 20 57 65 62 47  lues, hence WebG
01c0: 61 74 65 20 64 6f 65 73 6e 27 74 20 75 73 65 20  ate doesn't use 
01d0: 73 69 6d 70 6c 65 20 73 74 72 69 6e 67 73 20 61  simple strings a
01e0: 73 20 76 61 6c 75 65 73 20 69 6e 20 74 68 65 20  s values in the 
01f0: 70 61 72 61 6d 65 74 65 72 73 20 74 61 62 6c 65  parameters table
0200: 20 62 75 74 20 72 61 74 68 65 72 20 6c 69 73 74   but rather list
0210: 73 20 6f 66 20 69 6e 73 74 61 6e 63 65 73 20 6f  s of instances o
0220: 66 20 74 68 65 20 3c 74 74 3e 6d 65 73 73 61 67  f the <tt>messag
0230: 65 3c 2f 74 74 3e 20 73 74 72 75 63 74 75 72 65  e</tt> structure
0240: 20 74 68 61 74 20 68 61 73 20 61 20 53 52 46 49   that has a SRFI
0250: 2d 39 39 20 64 65 66 69 6e 69 74 69 6f 6e 20 73  -99 definition s
0260: 69 6d 69 6c 61 72 20 74 6f 20 74 68 69 73 20 6f  imilar to this o
0270: 6e 65 3a 0d 0a 0d 0a 3c 76 65 72 62 61 74 69 6d  ne:....<verbatim
0280: 3e 0d 0a 20 20 28 64 65 66 69 6e 65 2d 72 65 63  >..  (define-rec
0290: 6f 72 64 2d 74 79 70 65 20 6d 65 73 73 61 67 65  ord-type message
02a0: 0d 0a 20 20 20 20 23 66 20 23 74 0d 0a 20 20 20  ..    #f #t..   
02b0: 20 74 79 70 65 20 68 65 61 64 65 72 73 0d 0a 20   type headers.. 
02c0: 20 20 20 62 6f 64 79 29 0d 0a 3c 2f 76 65 72 62     body)..</verb
02d0: 61 74 69 6d 3e 0d 0a 0d 0a 54 68 65 20 3c 74 74  atim>....The <tt
02e0: 3e 74 79 70 65 3c 2f 74 74 3e 20 66 69 65 6c 64  >type</tt> field
02f0: 20 68 6f 6c 64 73 20 74 68 65 20 63 6f 6e 74 65   holds the conte
0300: 6e 74 20 74 79 70 65 20 6f 66 20 74 68 65 20 6d  nt type of the m
0310: 65 73 73 61 67 65 2c 20 3c 74 74 3e 68 65 61 64  essage, <tt>head
0320: 65 72 73 3c 2f 74 74 3e 20 63 6f 6e 74 61 69 6e  ers</tt> contain
0330: 73 20 61 6e 20 61 73 73 6f 63 69 61 74 69 6f 6e  s an association
0340: 20 6c 69 73 74 20 6f 66 20 68 65 61 64 65 72 73   list of headers
0350: 20 61 6e 64 20 3c 74 74 3e 62 6f 64 79 3c 2f 74   and <tt>body</t
0360: 74 3e 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20  t> contains the 
0370: 61 63 74 75 61 6c 20 70 61 79 6c 6f 61 64 20 64  actual payload d
0380: 61 74 61 20 61 73 20 61 20 73 74 72 69 6e 67 2e  ata as a string.
0390: 0d 0a 0d 0a 54 6f 20 61 63 63 65 73 73 20 74 65  ....To access te
03a0: 78 74 75 61 6c 20 64 61 74 61 20 63 6f 6e 76 65  xtual data conve
03b0: 6e 69 65 6e 74 6c 79 2c 20 74 68 65 72 65 20 69  niently, there i
03c0: 73 20 61 20 73 79 6e 74 68 65 74 69 63 20 61 63  s a synthetic ac
03d0: 63 65 73 73 6f 72 20 3c 74 74 3e 6d 65 73 73 61  cessor <tt>messa
03e0: 67 65 2d 74 65 78 74 3c 2f 74 74 3e 20 74 68 61  ge-text</tt> tha
03f0: 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 6d 65  t returns the me
0400: 73 73 61 67 65 20 62 6f 64 79 20 69 66 66 20 69  ssage body iff i
0410: 74 20 68 61 73 20 61 20 3c 74 74 3e 74 65 78 74  t has a <tt>text
0420: 2f 70 6c 61 69 6e 3c 2f 74 74 3e 20 63 6f 6e 74  /plain</tt> cont
0430: 65 6e 74 20 74 79 70 65 2e 0d 0a 0d 0a 54 68 65  ent type.....The
0440: 20 68 65 6c 70 65 72 73 20 3c 74 74 3e 70 61 72   helpers <tt>par
0450: 61 6d 65 74 65 72 2d 6c 69 73 74 2d 72 65 66 3c  ameter-list-ref<
0460: 2f 74 74 3e 20 61 6e 64 20 3c 74 74 3e 70 61 72  /tt> and <tt>par
0470: 61 6d 65 74 65 72 2d 72 65 66 3c 2f 74 74 3e 20  ameter-ref</tt> 
0480: 61 6c 6c 6f 77 20 79 6f 75 20 74 6f 20 65 78 74  allow you to ext
0490: 72 61 63 74 20 61 20 6c 69 73 74 20 6f 66 20 70  ract a list of p
04a0: 61 72 61 6d 65 74 65 72 20 76 61 6c 75 65 73 20  arameter values 
04b0: 6f 72 20 61 20 73 69 6e 67 6c 65 20 76 61 6c 75  or a single valu
04c0: 65 20 66 72 6f 6d 20 61 20 68 61 73 68 20 74 61  e from a hash ta
04d0: 62 6c 65 2e 20 54 68 65 79 20 74 61 6b 65 20 74  ble. They take t
04e0: 68 65 20 68 61 73 68 20 74 61 62 6c 65 2c 20 61  he hash table, a
04f0: 20 73 74 72 69 6e 67 20 6b 65 79 20 61 6e 64 20   string key and 
0500: 61 6e 20 6f 70 74 69 6f 6e 61 6c 20 63 6f 6e 76  an optional conv
0510: 65 72 74 65 72 20 66 72 6f 6d 20 6d 65 73 73 61  erter from messa
0520: 67 65 20 72 65 63 6f 72 64 73 20 74 6f 20 74 68  ge records to th
0530: 65 20 64 65 73 69 72 65 64 20 74 61 72 67 65 74  e desired target
0540: 20 74 79 70 65 20 61 73 20 61 72 67 75 6d 65 6e   type as argumen
0550: 74 73 2e 20 54 68 65 20 6d 65 73 73 61 67 65 20  ts. The message 
0560: 63 6f 6e 76 65 72 74 65 72 20 64 65 66 61 75 6c  converter defaul
0570: 74 73 20 74 6f 20 3c 74 74 3e 6d 65 73 73 61 67  ts to <tt>messag
0580: 65 2d 74 65 78 74 3c 2f 74 74 3e 2e 0d 0a 0a 5a  e-text</tt>....Z
0590: 20 65 35 38 32 36 32 65 36 63 63 38 39 37 32 65   e58262e6cc8972e
05a0: 65 33 35 31 64 34 64 64 65 33 37 33 33 34 35 39  e351d4dde3733459
05b0: 61 0a                                            a.