/usr/share/doc/racket/web-server/stateless.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>3 Stateless Servlets</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Web Applications in Racket</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="run.html" class="tocviewlink" data-pltdoc="x">Running Web Servlets</a></td></tr><tr><td align="right">2 </td><td><a href="servlet.html" class="tocviewlink" data-pltdoc="x">Stateful Servlets</a></td></tr><tr><td align="right">3 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Stateless Servlets</a></td></tr><tr><td align="right">4 </td><td><a href="http.html" class="tocviewlink" data-pltdoc="x">HTTP:<span class="mywbr"> </span> Hypertext Transfer Protocol</a></td></tr><tr><td align="right">5 </td><td><a href="dispatch.html" class="tocviewlink" data-pltdoc="x">URL-<wbr></wbr>Based Dispatch</a></td></tr><tr><td align="right">6 </td><td><a href="formlets.html" class="tocviewlink" data-pltdoc="x">Formlets:<span class="mywbr"> </span> Functional Form Abstraction</a></td></tr><tr><td align="right">7 </td><td><a href="templates.html" class="tocviewlink" data-pltdoc="x">Templates:<span class="mywbr"> </span> Separation of View</a></td></tr><tr><td align="right">8 </td><td><a href="page.html" class="tocviewlink" data-pltdoc="x">Page:<span class="mywbr"> </span> Short-<wbr></wbr>hand for Common Patterns</a></td></tr><tr><td align="right">9 </td><td><a href="test.html" class="tocviewlink" data-pltdoc="x">Testing Servlets</a></td></tr><tr><td align="right">10 </td><td><a href="faq.html" class="tocviewlink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>3 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Stateless Servlets</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">3.1 </td><td><a href="#%28part._stateless-example%29" class="tocviewlink" data-pltdoc="x">Example</a></td></tr><tr><td align="right">3.2 </td><td><a href="#%28part._considerations%29" class="tocviewlink" data-pltdoc="x">Usage Considerations</a></td></tr><tr><td align="right">3.3 </td><td><a href="#%28part._.Serializable_.Continuations%29" class="tocviewlink" data-pltdoc="x">Serializable Continuations</a></td></tr><tr><td align="right">3.4 </td><td><a href="#%28part._.Native_.Interfaces%29" class="tocviewlink" data-pltdoc="x">Native Interfaces</a></td></tr><tr><td align="right">3.5 </td><td><a href="#%28part._lang%2Fweb%29" class="tocviewlink" data-pltdoc="x">Stateless Web Interaction</a></td></tr><tr><td align="right">3.6 </td><td><a href="#%28part._lang%2Fweb-cells%29" class="tocviewlink" data-pltdoc="x">Stateless Web Cells</a></td></tr><tr><td align="right">3.7 </td><td><a href="#%28part._lang%2Ffile-box%29" class="tocviewlink" data-pltdoc="x">File Boxes</a></td></tr><tr><td align="right">3.8 </td><td><a href="#%28part._lang%2Fweb-param%29" class="tocviewlink" data-pltdoc="x">Stateless Web Parameters</a></td></tr><tr><td align="right">3.9 </td><td><a href="#%28part._.Soft_.State%29" class="tocviewlink" data-pltdoc="x">Soft State</a></td></tr><tr><td align="right">3.10 </td><td><a href="#%28part._stuffers%29" class="tocviewlink" data-pltdoc="x">Stuffers</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">3.1<tt> </tt></span><a href="#%28part._stateless-example%29" class="tocsubseclink" data-pltdoc="x">Example</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._interface-version%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">interface-<wbr></wbr>version</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._manager%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">manager</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._start%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">start</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.2<tt> </tt></span><a href="#%28part._considerations%29" class="tocsubseclink" data-pltdoc="x">Usage Considerations</a></td></tr><tr><td><span class="tocsublinknumber">3.3<tt> </tt></span><a href="#%28part._.Serializable_.Continuations%29" class="tocsubseclink" data-pltdoc="x">Serializable Continuations</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">call-<wbr></wbr>with-<wbr></wbr>serializable-<wbr></wbr>current-<wbr></wbr>continuation</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">serial-<wbr></wbr>>native</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">native-<wbr></wbr>>serial</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.4<tt> </tt></span><a href="#%28part._.Native_.Interfaces%29" class="tocsubseclink" data-pltdoc="x">Native Interfaces</a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fnative..rkt%29._define-native%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>native</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.5<tt> </tt></span><a href="#%28part._lang%2Fweb%29" class="tocsubseclink" data-pltdoc="x">Stateless Web Interaction</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>suspend/<span class="mywbr"> </span>url</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>suspend</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Fhidden%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>suspend/<span class="mywbr"> </span>hidden</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%2Fdispatch%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>suspend/<span class="mywbr"> </span>url/<span class="mywbr"> </span>dispatch</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>suspend/<span class="mywbr"> </span>dispatch</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._redirect%2Fget%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">redirect/<span class="mywbr"> </span>get</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.6<tt> </tt></span><a href="#%28part._lang%2Fweb-cells%29" class="tocsubseclink" data-pltdoc="x">Stateless Web Cells</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">web-<wbr></wbr>cell?</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._make-web-cell%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">make-<wbr></wbr>web-<wbr></wbr>cell</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell-ref%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">web-<wbr></wbr>cell-<wbr></wbr>ref</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell-shadow%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">web-<wbr></wbr>cell-<wbr></wbr>shadow</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.7<tt> </tt></span><a href="#%28part._lang%2Ffile-box%29" class="tocsubseclink" data-pltdoc="x">File Boxes</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">file-<wbr></wbr>box?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">file-<wbr></wbr>box</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-unbox%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">file-<wbr></wbr>unbox</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box-set~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">file-<wbr></wbr>box-<wbr></wbr>set?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box-set%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">file-<wbr></wbr>box-<wbr></wbr>set!</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.8<tt> </tt></span><a href="#%28part._lang%2Fweb-param%29" class="tocsubseclink" data-pltdoc="x">Stateless Web Parameters</a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._make-web-parameter%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">make-<wbr></wbr>web-<wbr></wbr>parameter</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._web-parameter~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">web-<wbr></wbr>parameter?</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._web-parameterize%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">web-<wbr></wbr>parameterize</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.9<tt> </tt></span><a href="#%28part._.Soft_.State%29" class="tocsubseclink" data-pltdoc="x">Soft State</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">soft-<wbr></wbr>state?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._make-soft-state%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>soft-<wbr></wbr>state</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state-ref%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">soft-<wbr></wbr>state-<wbr></wbr>ref</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">soft-<wbr></wbr>state</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10<tt> </tt></span><a href="#%28part._stuffers%29" class="tocsubseclink" data-pltdoc="x">Stuffers</a></td></tr><tr><td><span class="tocsublinknumber">3.10.1<tt> </tt></span><a href="#%28part._.Basic_.Combinators%29" class="tocsubseclink" data-pltdoc="x">Basic Combinators</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._id-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">id-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-compose%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer-<wbr></wbr>compose</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-sequence%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer-<wbr></wbr>sequence</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-if%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer-<wbr></wbr>if</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-chain%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stuffer-<wbr></wbr>chain</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.2<tt> </tt></span><a href="#%28part._.Serialization%29" class="tocsubseclink" data-pltdoc="x">Serialization</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fserialize..rkt%29._serialize-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serialize-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.3<tt> </tt></span><a href="#%28part._.Base64_.Encoding%29" class="tocsubseclink" data-pltdoc="x">Base64 Encoding</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fbase64..rkt%29._base64-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">base64-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.4<tt> </tt></span><a href="#%28part._.G.Zip_.Compression%29" class="tocsubseclink" data-pltdoc="x">GZip Compression</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fgzip..rkt%29._gzip-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">gzip-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.5<tt> </tt></span><a href="#%28part._.Key_.Value_.Storage%29" class="tocsubseclink" data-pltdoc="x">Key/<span class="mywbr"> </span>Value Storage</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._store%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">store</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._dir-store%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dir-<wbr></wbr>store</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.6<tt> </tt></span><a href="#%28part._.Hash-addressed_.Storage%29" class="tocsubseclink" data-pltdoc="x">Hash-<wbr></wbr>addressed Storage</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-fun%2Fc%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">hash-<wbr></wbr>fun/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">hash-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._md5-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">md5-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.7<tt> </tt></span><a href="#%28part._.H.M.A.C-.S.H.A1_.Signing%29" class="tocsubseclink" data-pltdoc="x">HMAC-<wbr></wbr>SHA1 Signing</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhmac-sha1..rkt%29._.H.M.A.C-.S.H.A1%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">HMAC-<wbr></wbr>SHA1</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhmac-sha1..rkt%29._.H.M.A.C-.S.H.A1-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">HMAC-<wbr></wbr>SHA1-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.10.8<tt> </tt></span><a href="#%28part._.Helpers%29" class="tocsubseclink" data-pltdoc="x">Helpers</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._is-url-too-big~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">is-<wbr></wbr>url-<wbr></wbr>too-<wbr></wbr>big?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._make-default-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>default-<wbr></wbr>stuffer</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._default-stuffer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">default-<wbr></wbr>stuffer</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="servlet.html" title="backward to "2 Stateful Servlets"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="http.html" title="forward to "4 HTTP: Hypertext Transfer Protocol"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""stateless"">3<tt> </tt><a name="(part._stateless)"></a><a name="(mod-path._web-server/base)"></a><a name="(mod-path._web-server)"></a>Stateless Servlets</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/base</span></a></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr><tr><td align="left" colspan="2"><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a></td></tr></table></p><a name="(part._stateless-example)"></a><p>A stateless servlet should <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._provide%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">provide</a></span> the following exports:</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/scribblings/dummy-stateless-servlet..rkt)._interface-version))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._interface-version%29%29" class="RktValDef RktValLink" data-pltdoc="x">interface-version</a></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._one-of%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">one-of/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">stateless</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This indicates that the servlet is a stateless servlet.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/scribblings/dummy-stateless-servlet..rkt)._stuffer))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer</a></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This is the <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that will be used for the servlet.</div></p><p>If it is not provided, it defaults to <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._default-stuffer%29%29" class="RktValLink" data-pltdoc="x">default-stuffer</a></span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/scribblings/dummy-stateless-servlet..rkt)._manager))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._manager%29%29" class="RktValDef RktValLink" data-pltdoc="x">manager</a></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._manager~3f%29%29" class="RktValLink" data-pltdoc="x">manager?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This is the <a href="servlet.html#%28tech._manager%29" class="techoutside" data-pltdoc="x"><span class="techinside">manager</span></a> that will be used for the servlet.</div></p><p>If it is not provided, it defaults to <span class="RktPn">(</span><span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29" class="RktValLink" data-pltdoc="x">create-none-manager</a></span><span class="stt"> </span><span class="RktVal">#f</span><span class="RktPn">)</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/scribblings/dummy-stateless-servlet..rkt)._start))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._start%29%29" class="RktValDef RktValLink" data-pltdoc="x">start</a></span><span class="hspace"> </span><span class="RktVar">initial-request</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">initial-request</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">This function is called when an instance of this servlet is started.
The argument is the HTTP request that initiated the instance.</div></p><p><div class="SIntrapara">An example <span class="RktVal">'</span><span class="RktVal">stateless</span> servlet module:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktSym">web-server/http</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._provide%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">provide</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._interface-version%29%29" class="RktValLink" data-pltdoc="x">interface-version</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._stuffer%29%29" class="RktValLink" data-pltdoc="x">stuffer</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._start%29%29" class="RktValLink" data-pltdoc="x">start</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._interface-version%29%29" class="RktValLink" data-pltdoc="x">interface-version</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">stateless</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._stuffer%29%29" class="RktValLink" data-pltdoc="x">stuffer</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-chain%29%29" class="RktValLink" data-pltdoc="x">stuffer-chain</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fserialize..rkt%29._serialize-stuffer%29%29" class="RktValLink" data-pltdoc="x">serialize-stuffer</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._md5-stuffer%29%29" class="RktValLink" data-pltdoc="x">md5-stuffer</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Filesystem.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._find-system-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">find-system-path</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">home-dir</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">".urls"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._start%29%29" class="RktValLink" data-pltdoc="x">start</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h2</span><span class="hspace"> </span><span class="RktVal">"Look ma, no state!"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/base</span></a> language exports all of the functions
and syntax from <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket/base</span></a> and nothing else.</p><p>The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a> language exports all of the functions
and syntax from the following libraries: <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a>,
<a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">net/url</span></a>, <a href="http.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http</span></a>,
<a href="http.html#%28mod-path._web-server%2Fhttp%2Fbindings%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/bindings</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Fabort-resume%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/abort-resume</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Fweb%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Fnative%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/native</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Fweb-param%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web-param</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web-cells</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Ffile-box%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/file-box</span></a>,
<a href="#%28mod-path._web-server%2Flang%2Fsoft%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/soft</span></a>,
<a href="dispatch.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/dispatch</span></a>, and
<a href="#%28mod-path._web-server%2Fstuffers%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers</span></a>. Some of these are documented in
the subsections that follow.</p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""considerations"">3.2<tt> </tt><a name="(part._considerations)"></a>Usage Considerations</h4><p><div class="SIntrapara">A stateless servlet has the following process performed on it
automatically:
</div><div class="SIntrapara"><ul><li><p>All uses of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=let.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._letrec%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">letrec</a></span> are removed and replaced with
equivalent uses of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=let.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._let%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">let</a></span> and imperative features.</p></li><li><p>The program is converted into <a href="http://en.wikipedia.org/wiki/Administrative_normal_form">ANF</a> (Administrative Normal Form),
making all continuations explicit.</p></li><li><p>All continuations and continuations marks are recorded in the
continuation marks of the expression
they are the continuation of.</p></li><li><p>All calls to external modules are identified and marked.</p></li><li><p>All uses of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=cont.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._call%252Fcc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">call/cc</a></span> are removed and replaced with
equivalent gathering of the continuations through the continuation marks installed earlier.</p></li><li><p>The program is defunctionalized with a serializable data-structure for each
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span>.</p></li></ul></div></p><p>This process allows the continuations captured by your servlet to be
serialized. This means they may be stored on the client’s browser or
the server’s disk.</p><p>This means your servlet has no cost to the server other than
execution. This is very attractive if you’ve used Racket servlets and
had memory problems.</p><p>This means your server can restart in the middle of a long running Web
interaction without the URLs that have been shared with the client
expiring. This is very attractive if you’ve used Racket servlets and
had session timeout problems.</p><p>This process is defined on all of Racket and occurs after
macro-expansion, so you are free to use all interesting features of
Racket. However, there are some considerations you must make.</p><p>First, this process drastically changes the structure of your program.
It will create an immense number of lambdas and structures your program
did not normally contain. The performance implication of this has not
been studied with Racket.</p><p>Second, the defunctionalization process is sensitive to the syntactic
structure of your program. Therefore, if you change your program in a
trivial way, for example, changing a constant, then all serialized
continuations will be obsolete and will error when deserialization is
attempted. This is a feature, not an error! It is a small price to pay
for protection from the sorts of errors that would occur if your
program were changed in a meaningful way. If you use the
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._default-stuffer%29%29" class="RktValLink" data-pltdoc="x">default-stuffer</a></span> or <a href="#%28mod-path._web-server%2Fstuffers%2Fhash%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/hash</span></a>,
then whenever you change your servlet’s code, you can safely delete
all saved continuations, because they won’t be used any longer.</p><p>Third, the values in the lexical scope of your continuations must be
serializable for the continuations itself to be serializable. This means
that you must use <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528form._%2528%2528lib._racket%252Fserialize..rkt%2529._define-serializable-struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define-serializable-struct</a></span> rather than
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define-struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define-struct</a></span>, and take care to use modules that do the same.
Similarly, you may not use <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=parameters.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fmore-scheme..rkt%2529._parameterize%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">parameterize</a></span>, because
parameterizations are not serializable.</p><p>Fourth, and related, this process only runs on your code, not on the
code you <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span>. Thus, your continuations—<wbr></wbr>to be
serializable—<wbr></wbr>must not be in the context of another module. For
example, the following will fail with an <a name="(idx._(gentag._1._(lib._web-server/scribblings/web-server..scrbl)))"></a>"unsafe context"
exception:</p><p><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">requests</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">rg</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%29%29" class="RktValLink" data-pltdoc="x">send/suspend/url</a></span><span class="hspace"> </span><span class="RktSym">rg</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">response-generators</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">because <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span> is not transformed by the process. However, if you defined
your own <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span> function, there would be no problem. Another solution is to
store the <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span> part of the continuation on the server with <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span>
and <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span>:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">requests</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">rg</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%29%29" class="RktValLink" data-pltdoc="x">send/suspend/url</a></span><span class="hspace"> </span><span class="RktSym">rg</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">response-generators</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>Fifth, the store is <span style="font-weight: bold">not</span> serialized. If you rely on the store you will
be taking huge risks. You will be assuming that the serialized continuation
is invoked on the same server before the server is restarted or
the memory is garbage collected.</p><p>This process is derived from the papers
<span style="font-style: italic"><a href="http://www.cs.brown.edu/~sk/Publications/Papers/Published/pcmkf-cont-from-gen-stack-insp/">Continuations from Generalized Stack Inspection</a></span> by Pettyjohn et al. in 2005,
<span style="font-style: italic"><a href="http://faculty.cs.byu.edu/~jay/static/icfp065-mccarthy.pdf">Automatically RESTful Web Applications, Or Marking Modular Serializable Continuations</a></span> by Jay McCarthy in 2009,
and
<span style="font-style: italic"><a href="http://faculty.cs.byu.edu/~jay/static/oopsla026-mccarthy.pdf">The Two-State Solution: Native and Serializable Continuations Accord</a></span> by Jay McCarthy in 2010,
We thank Greg Pettyjohn for his initial implementation of this algorithm.</p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Serializable_Continuations"">3.3<tt> </tt><a name="(part._.Serializable_.Continuations)"></a><a name="(mod-path._web-server/lang/abort-resume)"></a>Serializable Continuations</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fabort-resume%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/abort-resume</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">The main purpose of the stateless language is to provide serializable continuations to your servlet.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/abort-resume..rkt)._call-with-serializable-current-continuation))"></a><span title="Provided from: web-server/lang/abort-resume | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29" class="RktValDef RktValLink" data-pltdoc="x">call-with-serializable-current-continuation</a></span></span><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">any</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=cont.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">continuation?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Captures the current continuation in a serializable way and calls <span class="RktVar">response-generator</span> with it, returning the result.</div></p></div><div class="SIntrapara">This potentially uses resources of the current servlet’s <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._manager%29%29" class="RktValLink" data-pltdoc="x">manager</a></span> if <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span> and <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span> were used
to capture an untransformable context.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/abort-resume..rkt)._serial-~3enative))"></a><span title="Provided from: web-server/lang/abort-resume | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">serial->native</a></span></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span> informs the serializing runtime that <span class="RktVar">expr</span> is potentially a call to an untransformed context.
This sets up the necessary information for
<span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span> to signal to <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-serializable-current-continuation</a></span> to capture the native (and thus unserializable) section
of the context and store it on the server.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/abort-resume..rkt)._native-~3eserial))"></a><span title="Provided from: web-server/lang/abort-resume | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">native->serial</a></span></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span> informs the serializing runtime that <span class="RktVar">expr</span> marks first expression after returning from an untransformed context.
This captures the
untransformed context such that <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-serializable-current-continuation</a></span> can store it on the server and reference it from serializable
continuations.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">For example,
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._build-list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">3</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">i</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-serializable-current-continuation</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serialize%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serialize</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">will fail at runtime because <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._build-list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-list</a></span> is not transformed. However,
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._build-list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">3</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">i</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-serializable-current-continuation</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serialize%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serialize</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">will succeed and <span class="RktSym">k</span> will reference a cell in the current servlet’s <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-stateless-servlet..rkt%29._manager%29%29" class="RktValLink" data-pltdoc="x">manager</a></span> that stores the part of the continuation in
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._build-list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-list</a></span>.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Native_Interfaces"">3.4<tt> </tt><a name="(part._.Native_.Interfaces)"></a><a name="(mod-path._web-server/lang/native)"></a>Native Interfaces</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fnative%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/native</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">It is sometimes inconvenient to use <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span> and
<span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span> throughout your program. This module provides a
macro for creating wrappers.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/native..rkt)._define-native))"></a><span title="Provided from: web-server/lang/native | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fnative..rkt%29._define-native%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-native</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">native</span><span class="hspace"> </span><span class="RktVar">arg-spec</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">original</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><blockquote class="SubFlow"><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">arg-spec</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym">ho</span></td></tr></table><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">arg-spec</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529.__%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">_</a></span></td></tr></table></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Builds an interface around <span class="RktVar">original</span> named <span class="RktVar">native</span> such
that calls to <span class="RktVar">native</span> are wrapped in <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span>
and all arguments marked with <span class="RktSym">ho</span> in <span class="RktVar">arg-spec</span> are
assumed to procedures and are wrapped in <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">For example,
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fnative..rkt%29._define-native%29%29" class="RktStxLink" data-pltdoc="x">define-native</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">build-list/native</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529.__%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">_</a></span><span class="hspace"> </span><span class="RktSym">ho</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._build-list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-list</a></span><span class="RktPn">)</span></p></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara">is equivalent to
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">build-list/native</span><span class="hspace"> </span><span class="RktSym">fst</span><span class="hspace"> </span><span class="RktSym">snd</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._serial-~3enative%29%29" class="RktStxLink" data-pltdoc="x">serial->native</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._build-list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">fst</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktSym">args</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._native-~3eserial%29%29" class="RktStxLink" data-pltdoc="x">native->serial</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=procedures.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._apply%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">apply</a></span><span class="hspace"> </span><span class="RktSym">snd</span><span class="hspace"> </span><span class="RktSym">args</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""lang/web"">3.5<tt> </tt><a name="(part._lang/web)"></a><a name="(mod-path._web-server/lang/web)"></a>Stateless Web Interaction</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fweb%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web..rkt)._send/suspend/url))"></a><span title="Provided from: web-server/lang/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/suspend/url</a></span></span><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Captures the current continuation. Serializes it and stuffs it into
a URL. Calls <span class="RktVar">response-generator</span> with this URL and delivers
the response to the client. If the URL is invoked
the request is returned to this continuation.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web..rkt)._send/suspend))"></a><span title="Provided from: web-server/lang/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/suspend</a></span></span><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%29%29" class="RktValLink" data-pltdoc="x">send/suspend/url</a></span> but with a string URL representation.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web..rkt)._send/suspend/hidden))"></a><span title="Provided from: web-server/lang/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Fhidden%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/suspend/hidden</a></span></span><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">response-generator</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&rel=index.html%23%2528def._%2528%2528lib._xml%252Fprivate%252Fxexpr-core..rkt%2529._xexpr%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">xexpr/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Captures the current continuation. Serializes it and stuffs it into a hidden INPUT
form element.
Calls <span class="RktVar">response-generator</span> with this URL and form field and delivers
the response to the client. If the URL is invoked with form data containing
the hidden form,
the request is returned to this continuation.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web..rkt)._send/suspend/url/dispatch))"></a><span title="Provided from: web-server/lang/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%2Fdispatch%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/suspend/url/dispatch</a></span></span><span class="hspace"> </span><span class="RktVar">make-response</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">any</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">make-response</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">any</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktVar">make-response</span> with a function that, when called with a procedure from
<span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span> to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span> will generate a URL, that when invoked will call
the function with the <span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span> object and return the result to the caller of
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web..rkt)._send/suspend/dispatch))"></a><span title="Provided from: web-server/lang/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span></span><span class="hspace"> </span><span class="RktVar">make-response</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">make-response</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">any</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%2Furl%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/url/dispatch</a></span> but with a string URL representation.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web..rkt)._redirect/get))"></a><span title="Provided from: web-server/lang/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._redirect%2Fget%29%29" class="RktValDef RktValLink" data-pltdoc="x">redirect/get</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></p></blockquote></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">See <a href="servlet.html#%28mod-path._web-server%2Fservlet%2Fweb%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web</span></a>.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""lang/web-cells"">3.6<tt> </tt><a name="(part._lang/web-cells)"></a><a name="(mod-path._web-server/lang/web-cells)"></a>Stateless Web Cells</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web-cells</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">The
<a href="#%28mod-path._web-server%2Flang%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web-cells</span></a> library provides the same
API as <a href="servlet.html#%28mod-path._web-server%2Fservlet%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web-cells</span></a>, but in a way
compatible with the Web Language. The one difference is that
<span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._make-web-cell%29%29" class="RktStxLink" data-pltdoc="x">make-web-cell</a></span> is syntax, rather than a function.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web-cells..rkt)._web-cell~3f))"></a><span title="Provided from: web-server/lang/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">web-cell?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/web-cells..rkt)._make-web-cell))"></a><span title="Provided from: web-server/lang/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._make-web-cell%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">make-web-cell</a></span></span><span class="hspace"> </span><span class="RktVar">default-expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web-cells..rkt)._web-cell-ref))"></a><span title="Provided from: web-server/lang/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell-ref%29%29" class="RktValDef RktValLink" data-pltdoc="x">web-cell-ref</a></span></span><span class="hspace"> </span><span class="RktVar">wc</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">wc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell~3f%29%29" class="RktValLink" data-pltdoc="x">web-cell?</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web-cells..rkt)._web-cell-shadow))"></a><span title="Provided from: web-server/lang/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell-shadow%29%29" class="RktValDef RktValLink" data-pltdoc="x">web-cell-shadow</a></span></span><span class="hspace"> </span><span class="RktVar">wc</span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">wc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-cells..rkt%29._web-cell~3f%29%29" class="RktValLink" data-pltdoc="x">web-cell?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">See <a href="servlet.html#%28mod-path._web-server%2Fservlet%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web-cells</span></a>.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""lang/file-box"">3.7<tt> </tt><a name="(part._lang/file-box)"></a><a name="(mod-path._web-server/lang/file-box)"></a>File Boxes</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Ffile-box%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/file-box</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">As mentioned earlier, it is dangerous to rely on the store in
Web Language servlets, due to the deployment scenarios available
to them. This module provides a simple API to replace
boxes in a safe way.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/file-box..rkt)._file-box~3f))"></a><span title="Provided from: web-server/lang/file-box | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-box?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Checks if <span class="RktVar">v</span> is a file-box.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/file-box..rkt)._file-box))"></a><span title="Provided from: web-server/lang/file-box | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-box</a></span></span><span class="hspace"> </span><span class="RktVar">p</span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box~3f%29%29" class="RktValLink" data-pltdoc="x">file-box?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a file-box that is stored at <span class="RktVar">p</span>, with the default
contents of <span class="RktVar">v</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/file-box..rkt)._file-unbox))"></a><span title="Provided from: web-server/lang/file-box | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-unbox%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-unbox</a></span></span><span class="hspace"> </span><span class="RktVar">fb</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">fb</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box~3f%29%29" class="RktValLink" data-pltdoc="x">file-box?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the value inside <span class="RktVar">fb</span></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/file-box..rkt)._file-box-set~3f))"></a><span title="Provided from: web-server/lang/file-box | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box-set~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-box-set?</a></span></span><span class="hspace"> </span><span class="RktVar">fb</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">fb</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box~3f%29%29" class="RktValLink" data-pltdoc="x">file-box?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">fb</span> contains a value.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/file-box..rkt)._file-box-set!))"></a><span title="Provided from: web-server/lang/file-box | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box-set%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-box-set!</a></span></span><span class="hspace"> </span><span class="RktVar">fb</span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">fb</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Ffile-box..rkt%29._file-box~3f%29%29" class="RktValLink" data-pltdoc="x">file-box?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Saves <span class="RktVar">v</span> in the file represented by <span class="RktVar">fb</span>.</div></p></div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>If you plan on using a load-balancer, make sure your file-boxes
are on a shared medium.</div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""lang/web-param"">3.8<tt> </tt><a name="(part._lang/web-param)"></a><a name="(mod-path._web-server/lang/web-param)"></a>Stateless Web Parameters</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fweb-param%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/web-param</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">It is not easy to use <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=parameters.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fmore-scheme..rkt%2529._parameterize%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">parameterize</a></span> in the
Web Language. This module provides (roughly) the same
functionality in a way that is serializable. Like other serializable
things in the Web Language, they are sensitive to source code modification.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/web-param..rkt)._make-web-parameter))"></a><span title="Provided from: web-server/lang/web-param | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._make-web-parameter%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">make-web-parameter</a></span></span><span class="hspace"> </span><span class="RktVar">default</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Expands to the definition of a web-parameter with
<span class="RktVar">default</span> as the default value. A web-parameter is
a procedure that, when called with zero arguments, returns <span class="RktVar">default</span>
or the last value <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._web-parameterize%29%29" class="RktStxLink" data-pltdoc="x">web-parameterize</a></span>d in the dynamic context
of the call.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/web-param..rkt)._web-parameter~3f))"></a><span title="Provided from: web-server/lang/web-param | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._web-parameter~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">web-parameter?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Checks if <span class="RktVar">v</span> appears to be a web-parameter.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/web-param..rkt)._web-parameterize))"></a><span title="Provided from: web-server/lang/web-param | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fweb-param..rkt%29._web-parameterize%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">web-parameterize</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktVar">web-parameter-expr</span><span class="hspace"> </span><span class="RktVar">value-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Runs <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=begin.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._begin%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">begin</a></span><span class="stt"> </span><span class="RktVar">expr</span><span class="stt"> </span><span class="RktMeta"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> such that the web-parameters that
the <span class="RktVar">web-parameter-expr</span>s evaluate to are bound to the <span class="RktVar">value-expr</span>s.
From the perspective of the <span class="RktVar">value-expr</span>s, this is like <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=let.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._let%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">let</a></span>.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Soft_State"">3.9<tt> </tt><a name="(part._.Soft_.State)"></a><a name="(mod-path._web-server/lang/soft)"></a>Soft State</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fsoft%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/soft</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">Sometimes you want to reference a large data-structure from a stateless program without the data-structure being serialized
and increasing the size of the serialization. This module provides support for this scenario.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/soft..rkt)._soft-state~3f))"></a><span title="Provided from: web-server/lang/soft | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">soft-state?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Determines if <span class="RktVar">v</span> is a soft state record.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/soft..rkt)._make-soft-state))"></a><span title="Provided from: web-server/lang/soft | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._make-soft-state%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-soft-state</a></span></span><span class="hspace"> </span><span class="RktVar">thnk</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state~3f%29%29" class="RktValLink" data-pltdoc="x">soft-state?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">thnk</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a piece of soft state that is computed by <span class="RktVar">thnk</span>. This value is serializable.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/soft..rkt)._soft-state-ref))"></a><span title="Provided from: web-server/lang/soft | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state-ref%29%29" class="RktValDef RktValLink" data-pltdoc="x">soft-state-ref</a></span></span><span class="hspace"> </span><span class="RktVar">ss</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ss</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state~3f%29%29" class="RktValLink" data-pltdoc="x">soft-state?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Extracts the value associated with <span class="RktVar">ss</span>. If the value is not
available (perhaps because of garbage collection, deserialization in an
uninitialized process, etc), then the thunk associated with <span class="RktVar">ss</span>
is invoked and the value is cached.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/lang/soft..rkt)._soft-state))"></a><span title="Provided from: web-server/lang/soft | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">soft-state</a></span></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._make-soft-state%29%29" class="RktValLink" data-pltdoc="x">make-soft-state</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktVar">expr</span><span class="stt"> </span><span class="RktMeta"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="RktPn">)</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Here’s an example servlet that uses soft state:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._provide%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">provide</a></span><span class="hspace"> </span><span class="RktSym">interface-version</span><span class="hspace"> </span><span class="RktSym">start</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">interface-version</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">stateless</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">softie</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state%29%29" class="RktStxLink" data-pltdoc="x">soft-state</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._printf%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">printf</a></span><span class="hspace"> </span><span class="RktVal">"Doing a long computation...\n"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=threads.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._sleep%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">sleep</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fsoft..rkt%29._soft-state-ref%29%29" class="RktValLink" data-pltdoc="x">soft-state-ref</a></span><span class="hspace"> </span><span class="RktSym">softie</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._printf%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">printf</a></span><span class="hspace"> </span><span class="RktVal">"Done\n"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k-url</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">[</span><span class="RktVal">href</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktSym">k-url</span><span class="RktVal">]</span><span class="RktVal">)</span><span class="hspace"> </span><span class="RktVal">"Done"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara">When this is run and the link is clicked a few times, the output is:
</div><div class="SIntrapara"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">$ plt-web-server -p 8080</span></p></td></tr><tr><td><p><span class="stt">Doing a long computation...</span></p></td></tr><tr><td><p><span class="stt">Done</span></p></td></tr><tr><td><p><span class="stt">Done</span></p></td></tr><tr><td><p><span class="stt">Done</span></p></td></tr><tr><td><p><span class="stt">Done</span></p></td></tr></table></div></p></div><div class="SIntrapara"><p><div class="SIntrapara">If the server is restarted or the hostname in the URL is changed to a different host with the same code, and the URL is clicked:
</div><div class="SIntrapara"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">^Cuser break</span></p></td></tr><tr><td><p><span class="stt">$ plt-web-server -p 8080</span></p></td></tr><tr><td><p><span class="stt">Doing a long computation...</span></p></td></tr><tr><td><p><span class="stt">Done</span></p></td></tr></table></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""stuffers"">3.10<tt> </tt><a name="(part._stuffers)"></a><a name="(mod-path._web-server/stuffers)"></a>Stuffers</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></p><p>The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a> language provides serializable continuations.
The serialization functionality is abstracted into <a name="(tech._stuffer)"></a><span style="font-style: italic">stuffers</span> that control how it operates.
You can supply your own (built with these functions) when you write a stateless servlet.</p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Basic_Combinators"">3.10.1<tt> </tt><a name="(part._.Basic_.Combinators)"></a><a name="(mod-path._web-server/stuffers/stuffer)"></a>Basic Combinators</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fstuffer%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/stuffer</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer-out))"></a><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer-in))"></a><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._make-stuffer))"></a><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer~3f))"></a><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._struct~3astuffer))"></a><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">in</span><span class="stt"> </span><span class="RktSym">out</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._make-stuffer%29%29" class="RktValLink" data-pltdoc="x">make-stuffer</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">in</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">out</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> is essentially an invertible function captured in this structure.
The following should hold:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym">out</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">in</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%7E3d%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">=</a></span><span class="hspace"> </span><span class="RktSym">x</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym">in</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">out</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%7E3d%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">=</a></span><span class="hspace"> </span><span class="RktSym">x</span></td></tr></table></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer/c))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer/c</a></span></span><span class="hspace"> </span><span class="RktVar">dom</span><span class="hspace"> </span><span class="RktVar">rng</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">dom</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">rng</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a contract for a <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> where <span class="RktSym">in</span> has
the contract <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="stt"> </span><span class="RktVar">dom</span><span class="stt"> </span><span class="RktVar">rng</span><span class="RktPn">)</span> and <span class="RktSym">out</span> has the contract
<span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="stt"> </span><span class="RktVar">rng</span><span class="stt"> </span><span class="RktVar">dom</span><span class="RktPn">)</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._id-stuffer))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._id-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">id-stuffer</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">The identitiy <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer-compose))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-compose%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer-compose</a></span></span><span class="hspace"> </span><span class="RktVar">g</span><span class="hspace"> </span><span class="RktVar">f</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">g</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">f</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Composes <span class="RktVar">f</span> and <span class="RktVar">g</span>, i.e., applies <span class="RktVar">f</span> then
<span class="RktVar">g</span> for <span class="RktSym">in</span> and <span class="RktVar">g</span> then <span class="RktVar">f</span> for
<span class="RktSym">out</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer-sequence))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-sequence%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer-sequence</a></span></span><span class="hspace"> </span><span class="RktVar">f</span><span class="hspace"> </span><span class="RktVar">g</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">f</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">g</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-compose%29%29" class="RktValLink" data-pltdoc="x">stuffer-compose</a></span> with arguments swapped.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer-if))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-if%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer-if</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span><span class="RktVar">f</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">f</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that stuffs with <span class="RktVar">f</span> if <span class="RktVar">c</span> is
true on the input to <span class="RktSym">in</span>. Similarly, applies <span class="RktVar">f</span> during
<span class="RktSym">out</span> if it was applied during <span class="RktSym">in</span> (which is recorded by
prepending a byte.)</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/stuffer..rkt)._stuffer-chain))"></a><span title="Provided from: web-server/stuffers/stuffer | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-chain%29%29" class="RktValDef RktValLink" data-pltdoc="x">stuffer-chain</a></span></span><span class="hspace"> </span><span class="RktVar">x</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer~3f%29%29" class="RktValLink" data-pltdoc="x">stuffer?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">x</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer~3f%29%29" class="RktValLink" data-pltdoc="x">stuffer?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Applies <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-sequence%29%29" class="RktValLink" data-pltdoc="x">stuffer-sequence</a></span> and <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-if%29%29" class="RktValLink" data-pltdoc="x">stuffer-if</a></span> to successive tails of <span class="RktVar">x</span>.</div></p></div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Serialization"">3.10.2<tt> </tt><a name="(part._.Serialization)"></a><a name="(mod-path._web-server/stuffers/serialize)"></a>Serialization</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fserialize%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/serialize</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/stuffers/serialize..rkt)._serialize-stuffer))"></a><span title="Provided from: web-server/stuffers/serialize | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fserialize..rkt%29._serialize-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">serialize-stuffer</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that uses <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serialize%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serialize</a></span> and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=unstable&rel=bytes.html%23%2528def._%2528%2528lib._unstable%252Fbytes..rkt%2529._write%252Fbytes%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write/bytes</a></span>
and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._deserialize%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">deserialize</a></span> and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=unstable&rel=bytes.html%23%2528def._%2528%2528lib._unstable%252Fbytes..rkt%2529._read%252Fbytes%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">read/bytes</a></span>.</div></p></div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Base64_Encoding"">3.10.3<tt> </tt><a name="(part._.Base64_.Encoding)"></a><a name="(mod-path._web-server/stuffers/base64)"></a>Base64 Encoding</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fbase64%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/base64</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/stuffers/base64..rkt)._base64-stuffer))"></a><span title="Provided from: web-server/stuffers/base64 | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fbase64..rkt%29._base64-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">base64-stuffer</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that uses <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=base64.html%23%2528def._%2528%2528lib._net%252Fbase64..rkt%2529._base64-encode%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">base64-encode</a></span> and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=base64.html%23%2528def._%2528%2528lib._net%252Fbase64..rkt%2529._base64-decode%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">base64-decode</a></span>.</div></p></div><div class="SIntrapara">Useful for getting URL-safe bytes.</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""GZip_Compression"">3.10.4<tt> </tt><a name="(part._.G.Zip_.Compression)"></a><a name="(mod-path._web-server/stuffers/gzip)"></a>GZip Compression</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fgzip%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/gzip</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/stuffers/gzip..rkt)._gzip-stuffer))"></a><span title="Provided from: web-server/stuffers/gzip | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fgzip..rkt%29._gzip-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">gzip-stuffer</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that uses <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=gzip.html%23%2528def._%2528%2528lib._web-server%252Fprivate%252Fgzip..rkt%2529._gzip%252Fbytes%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">gzip/bytes</a></span> and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=gzip.html%23%2528def._%2528%2528lib._web-server%252Fprivate%252Fgzip..rkt%2529._gunzip%252Fbytes%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">gunzip/bytes</a></span>.</div></p></div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>You should compose this with <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fbase64..rkt%29._base64-stuffer%29%29" class="RktValLink" data-pltdoc="x">base64-stuffer</a></span> to get
URL-safe bytes.</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Key_Value_Storage"">3.10.5<tt> </tt><a name="(part._.Key_.Value_.Storage)"></a><a name="(mod-path._web-server/stuffers/store)"></a>Key/Value Storage</h5><p>The <a href="#%28mod-path._web-server%2Fstuffers%2Fhash%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/hash</span></a> <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffers</span></a> rely on a
key/value store.</p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fstore%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/store</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/stuffers/store..rkt)._store-read))"></a><a name="(def._((lib._web-server/stuffers/store..rkt)._store-write))"></a><a name="(def._((lib._web-server/stuffers/store..rkt)._make-store))"></a><a name="(def._((lib._web-server/stuffers/store..rkt)._store~3f))"></a><a name="(def._((lib._web-server/stuffers/store..rkt)._struct~3astore))"></a><a name="(def._((lib._web-server/stuffers/store..rkt)._store))"></a><span title="Provided from: web-server/stuffers/store | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._store%29%29" class="RktValDef RktValLink" data-pltdoc="x">store</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">write</span><span class="stt"> </span><span class="RktSym">read</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._make-store%29%29" class="RktValLink" data-pltdoc="x">make-store</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">write</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">read</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">The following should hold:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=begin.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._begin%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._write%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="hspace"> </span><span class="RktSym">v</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Reading.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._read%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">read</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%7E3d%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">=</a></span><span class="hspace"> </span><span class="RktSym">v</span></p></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/store..rkt)._dir-store))"></a><span title="Provided from: web-server/stuffers/store | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._dir-store%29%29" class="RktValDef RktValLink" data-pltdoc="x">dir-store</a></span></span><span class="hspace"> </span><span class="RktVar">root</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._store~3f%29%29" class="RktValLink" data-pltdoc="x">store?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">root</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A store that stores key <span class="RktSym">key</span>’s value in a file located at
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">root</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes-%7E3estring%252Futf-8%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes->string/utf-8</a></span><span class="hspace"> </span><span class="RktSym">key</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div><div class="SIntrapara">It should be easy to use this interface to create store for databases like SQLite, CouchDB, or BerkeleyDB.</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Hash-addressed_Storage"">3.10.6<tt> </tt><a name="(part._.Hash-addressed_.Storage)"></a><a name="(mod-path._web-server/stuffers/hash)"></a>Hash-addressed Storage</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fhash%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/hash</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/stuffers/hash..rkt)._hash-fun/c))"></a><span title="Provided from: web-server/stuffers/hash | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-fun%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">hash-fun/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/hash..rkt)._hash-stuffer))"></a><span title="Provided from: web-server/stuffers/hash | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">hash-stuffer</a></span></span><span class="hspace"> </span><span class="RktVar">H</span><span class="hspace"> </span><span class="RktVar">store</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">H</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-fun%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash-fun/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">store</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._store~3f%29%29" class="RktValLink" data-pltdoc="x">store?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A content-addressed storage <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that stores input bytes,
<span class="RktSym">input</span>, in <span class="RktVar">store</span> with the key <span class="RktPn">(</span><span class="RktVar">H</span><span class="stt"> </span><span class="RktSym">input</span><span class="RktPn">)</span> and
returns the key. Similarly, on <span class="RktSym">out</span> the original bytes are
looked up.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/hash..rkt)._md5-stuffer))"></a><span title="Provided from: web-server/stuffers/hash | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._md5-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">md5-stuffer</a></span></span><span class="hspace"> </span><span class="RktVar">root</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">root</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-stuffer%29%29" class="RktValLink" data-pltdoc="x">hash-stuffer</a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=file&rel=md5.html%23%2528def._%2528%2528lib._file%252Fmd5..rkt%2529._md5%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">md5</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstore..rkt%29._dir-store%29%29" class="RktValLink" data-pltdoc="x">dir-store</a></span><span class="stt"> </span><span class="RktVar">root</span><span class="RktPn">)</span><span class="RktPn">)</span></div></p></div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""HMAC-SHA1_Signing"">3.10.7<tt> </tt><a name="(part._.H.M.A.C-.S.H.A1_.Signing)"></a><a name="(mod-path._web-server/stuffers/hmac-sha1)"></a>HMAC-SHA1 Signing</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fstuffers%2Fhmac-sha1%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/stuffers/hmac-sha1</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/hmac-sha1..rkt)._.H.M.A.C-.S.H.A1))"></a><span title="Provided from: web-server/stuffers/hmac-sha1 | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhmac-sha1..rkt%29._.H.M.A.C-.S.H.A1%29%29" class="RktValDef RktValLink" data-pltdoc="x">HMAC-SHA1</a></span></span><span class="hspace"> </span><span class="RktVar">kb</span><span class="hspace"> </span><span class="RktVar">db</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">kb</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">db</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Performs a HMAC-SHA1 calculation on <span class="RktVar">db</span> using <span class="RktVar">kb</span> as
the key. The result is guaranteed to be 20 bytes. (You could curry
this to use it with <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-stuffer%29%29" class="RktValLink" data-pltdoc="x">hash-stuffer</a></span>, but there is little value
in doing so over <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=file&rel=md5.html%23%2528def._%2528%2528lib._file%252Fmd5..rkt%2529._md5%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">md5</a></span>.)</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/stuffers/hmac-sha1..rkt)._.H.M.A.C-.S.H.A1-stuffer))"></a><span title="Provided from: web-server/stuffers/hmac-sha1 | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhmac-sha1..rkt%29._.H.M.A.C-.S.H.A1-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">HMAC-SHA1-stuffer</a></span></span><span class="hspace"> </span><span class="RktVar">kb</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">kb</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that signs input using <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhmac-sha1..rkt%29._.H.M.A.C-.S.H.A1%29%29" class="RktValLink" data-pltdoc="x">HMAC-SHA1</a></span> with
<span class="RktVar">kb</span> as the key. The result of the <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> is the hash
prepended to the input data. When the <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> is run in
reverse, it checks if the first 20 bytes are the correct has for the
rest of the data.</div></p></div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>You should compose this with <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fbase64..rkt%29._base64-stuffer%29%29" class="RktValLink" data-pltdoc="x">base64-stuffer</a></span> to get
URL-safe bytes.</div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>Without explicit provision, it is possible for users to
modify the continuations they are sent through the other
<a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffers</span></a>. This <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> allows the servlet to certify
that stuffed data was truly generated by the servlet. Therefore, you
<span style="font-weight: bold">should</span> use this if you are not using the
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._hash-stuffer%29%29" class="RktValLink" data-pltdoc="x">hash-stuffer</a></span>s.</div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>This <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> does <span style="font-weight: bold">not</span> encrypt the data in
anyway, so users can still observe the stuffed values.</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Helpers"">3.10.8<tt> </tt><a name="(part._.Helpers)"></a><a name="(mod-path._web-server/lang/stuff-url)"></a>Helpers</h5><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Flang%2Fstuff-url%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/lang/stuff-url</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/stuff-url..rkt)._is-url-too-big~3f))"></a><span title="Provided from: web-server/lang/stuff-url | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._is-url-too-big~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">is-url-too-big?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Determines if stuffing <span class="RktVar">v</span> into the current servlet’s URL would
result in a URL that is too big for Internet Explorer.
(<a href="http://www.boutell.com/newfaq/misc/urllength.html">IE only
supports URLs up to 2048 characters.</a>)</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/lang/stuff-url..rkt)._make-default-stuffer))"></a><span title="Provided from: web-server/lang/stuff-url | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._make-default-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-default-stuffer</a></span></span><span class="hspace"> </span><span class="RktVar">root</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">root</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a <a href="#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a> that serializes, then if the URL is too
big, compresses (and base64-encodes), if the URL is still too big then
it stores it in an MD5-indexed database rooted at <span class="RktVar">root</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Equivalent to:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-chain%29%29" class="RktValLink" data-pltdoc="x">stuffer-chain</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fserialize..rkt%29._serialize-stuffer%29%29" class="RktValLink" data-pltdoc="x">serialize-stuffer</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._is-url-too-big~3f%29%29" class="RktValLink" data-pltdoc="x">is-url-too-big?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer-chain%29%29" class="RktValLink" data-pltdoc="x">stuffer-chain</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fgzip..rkt%29._gzip-stuffer%29%29" class="RktValLink" data-pltdoc="x">gzip-stuffer</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fbase64..rkt%29._base64-stuffer%29%29" class="RktValLink" data-pltdoc="x">base64-stuffer</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._is-url-too-big~3f%29%29" class="RktValLink" data-pltdoc="x">is-url-too-big?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fhash..rkt%29._md5-stuffer%29%29" class="RktValLink" data-pltdoc="x">md5-stuffer</a></span><span class="hspace"> </span><span class="RktVar">root</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/lang/stuff-url..rkt)._default-stuffer))"></a><span title="Provided from: web-server/lang/stuff-url | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._default-stuffer%29%29" class="RktValDef RktValLink" data-pltdoc="x">default-stuffer</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._make-default-stuffer%29%29" class="RktValLink" data-pltdoc="x">make-default-stuffer</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Filesystem.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._find-system-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">find-system-path</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">home-dir</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">".urls"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="servlet.html" title="backward to "2 Stateful Servlets"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="http.html" title="forward to "4 HTTP: Hypertext Transfer Protocol"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|