/usr/share/doc/racket/web-server/servlet.html is in racket-doc 6.7-3.
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 | <!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>2 Stateful 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="" class="tocviewselflink" data-pltdoc="x">Stateful Servlets</a></td></tr><tr><td align="right">3 </td><td><a href="stateless.html" class="tocviewlink" 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>2 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Stateful Servlets</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">2.1 </td><td><a href="#%28part._servlet-example%29" class="tocviewlink" data-pltdoc="x">Example</a></td></tr><tr><td align="right">2.2 </td><td><a href="#%28part._servlet-structs%29" class="tocviewlink" data-pltdoc="x">Responses</a></td></tr><tr><td align="right">2.3 </td><td><a href="#%28part._web%29" class="tocviewlink" data-pltdoc="x">Web Interaction</a></td></tr><tr><td align="right">2.4 </td><td><a href="#%28part._web-cells%29" class="tocviewlink" data-pltdoc="x">Web Cells</a></td></tr><tr><td align="right">2.5 </td><td><a href="#%28part._managers%29" class="tocviewlink" data-pltdoc="x">Continuation Managers</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">2.1<tt> </tt></span><a href="#%28part._servlet-example%29" class="tocsubseclink" data-pltdoc="x">Example</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-v2-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-v2-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-v2-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">2.2<tt> </tt></span><a href="#%28part._servlet-structs%29" class="tocsubseclink" data-pltdoc="x">Responses</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">can-<wbr></wbr>be-<wbr></wbr>response?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">any-<wbr></wbr>>response</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._set-any-~3eresponse%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">set-<wbr></wbr>any-<wbr></wbr>>response!</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2.3<tt> </tt></span><a href="#%28part._web%29" class="tocsubseclink" data-pltdoc="x">Web Interaction</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fback%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>back</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%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%2Fservlet%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%2Fservlet%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%2Fservlet%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%2Fservlet%2Fweb..rkt%29._send%2Fforward%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>forward</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Ffinish%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">send/<span class="mywbr"> </span>finish</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%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><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._redirect%2Fget%2Fforget%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">redirect/<span class="mywbr"> </span>get/<span class="mywbr"> </span>forget</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._current-servlet-continuation-expiration-handler%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">current-<wbr></wbr>servlet-<wbr></wbr>continuation-<wbr></wbr>expiration-<wbr></wbr>handler</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._clear-continuation-table%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">clear-<wbr></wbr>continuation-<wbr></wbr>table!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._with-errors-to-browser%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">with-<wbr></wbr>errors-<wbr></wbr>to-<wbr></wbr>browser</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._adjust-timeout%21%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">adjust-<wbr></wbr>timeout!</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._continuation-url~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">continuation-<wbr></wbr>url?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._servlet-prompt%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">servlet-<wbr></wbr>prompt</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2.4<tt> </tt></span><a href="#%28part._web-cells%29" class="tocsubseclink" data-pltdoc="x">Web Cells</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%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="#%28def._%28%28lib._web-server%2Fservlet%2Fweb-cells..rkt%29._make-web-cell%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>web-<wbr></wbr>cell</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet%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%2Fservlet%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">2.5<tt> </tt></span><a href="#%28part._managers%29" class="tocsubseclink" data-pltdoc="x">Continuation Managers</a></td></tr><tr><td><span class="tocsublinknumber">2.5.1<tt> </tt></span><a href="#%28part._manager%29" class="tocsubseclink" data-pltdoc="x">General</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..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%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-instance%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">exn:<span class="mywbr"> </span>fail:<span class="mywbr"> </span>servlet-<wbr></wbr>manager:<span class="mywbr"> </span>no-<wbr></wbr>instance</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-continuation%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">exn:<span class="mywbr"> </span>fail:<span class="mywbr"> </span>servlet-<wbr></wbr>manager:<span class="mywbr"> </span>no-<wbr></wbr>continuation</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2.5.2<tt> </tt></span><a href="#%28part._none%29" class="tocsubseclink" data-pltdoc="x">No Continuations</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">create-<wbr></wbr>none-<wbr></wbr>manager</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2.5.3<tt> </tt></span><a href="#%28part._timeouts%29" class="tocsubseclink" data-pltdoc="x">Timeouts</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Ftimeouts..rkt%29._create-timeout-manager%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">create-<wbr></wbr>timeout-<wbr></wbr>manager</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2.5.4<tt> </tt></span><a href="#%28part._lru%29" class="tocsubseclink" data-pltdoc="x">LRU</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._create-.L.R.U-manager%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">create-<wbr></wbr>LRU-<wbr></wbr>manager</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>threshold-<wbr></wbr>LRU-<wbr></wbr>manager</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.7", "../");" 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.7");">top</a></span><span class="navright"> <a href="run.html" title="backward to "1 Running Web Servlets"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="stateless.html" title="forward to "3 Stateless Servlets"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""servlet"">2<tt> </tt><a name="(part._servlet)"></a><a name="(mod-path._web-server/servlet)"></a>Stateful Servlets</h3><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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet</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><a name="(part._servlet-example)"></a><p>A stateful servlet should <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._provide%2529%2529&version=6.7" 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-v2-servlet..rkt)._interface-version))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-v2-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="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">one-of/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">v2</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This indicates that the servlet is a version two 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-v2-servlet..rkt)._manager))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-v2-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="#%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">The <a href="#%28tech._manager%29" class="techoutside" data-pltdoc="x"><span class="techinside">manager</span></a> for the continuations of this servlet. See <a href="#%28part._managers%29" data-pltdoc="x">Continuation Managers</a> for options.</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/scribblings/dummy-v2-servlet..rkt)._start))"></a><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-v2-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">can-be-response?</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>An example version 2 module:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktSym">web-server/http</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">web-server/managers/none</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._provide%2529%2529&version=6.7" 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-v2-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-v2-servlet..rkt%29._manager%29%29" class="RktValLink" data-pltdoc="x">manager</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fscribblings%2Fdummy-v2-servlet..rkt%29._start%29%29" class="RktValLink" data-pltdoc="x">start</a></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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" 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-v2-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">v2</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" 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-v2-servlet..rkt%29._manager%29%29" class="RktValLink" data-pltdoc="x">manager</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29" class="RktValLink" data-pltdoc="x">create-none-manager</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</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">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"No Continuations Here!"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"No Continuations Here!"</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></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" 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-v2-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">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Hello World!"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"Hi Mom!"</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><p>These servlets have an extensive API available to them: <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=net&rel=url.html&version=6.7" 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%2Fservlet%2Fservlet-structs%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/servlet-structs</span></a>, <a href="#%28mod-path._web-server%2Fservlet%2Fweb%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web</span></a>,
<a href="#%28mod-path._web-server%2Fservlet%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web-cells</span></a>, and <a href="dispatch.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/dispatch</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-source-pkg="web-server-doc" x-part-tag=""servlet-structs"">2.2<tt> </tt><a name="(part._servlet-structs)"></a><a name="(mod-path._web-server/servlet/servlet-structs)"></a>Responses</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fservlet%2Fservlet-structs%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/servlet-structs</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">Servlets communicate to the Web Server by returning HTTP responses. In order to
accommodate lightweight programs (and backwards compatibility), the Web Server
provides an indirection from application-specific response formats and the internal
HTTP response format, <span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span>.</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/servlet/servlet-structs..rkt)._can-be-response~3f))"></a><span title="Provided from: web-server/servlet/servlet-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">can-be-response?</a></span></span><span class="hspace"> </span><span class="RktVar">x</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">boolean?</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="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet/servlet-structs..rkt)._any-~3eresponse))"></a><span title="Provided from: web-server/servlet/servlet-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValDef RktValLink" data-pltdoc="x">any->response</a></span></span><span class="hspace"> </span><span class="RktVar">x</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></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></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="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet/servlet-structs..rkt)._set-any-~3eresponse!))"></a><span title="Provided from: web-server/servlet/servlet-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._set-any-~3eresponse%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">set-any->response!</a></span></span><span class="hspace"> </span><span class="RktVar">new-any->response</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">new-any->response</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></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><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValLink" data-pltdoc="x">any->response</a></span> coerces any value into a response or returns <span class="RktVal">#f</span> if coercion is not possible.
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValLink" data-pltdoc="x">any->response</a></span> guarantees that any <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> input must always be returned exactly (i.e. <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eq%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">eq?</a></span>.)
The default always returns <span class="RktVal">#f</span>, signifying that no coercion is possible.</div></p></div><div class="SIntrapara"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span> returns <span class="RktVal">#t</span> if <span class="RktVar">x</span> is a response or can be turned into a response by calling
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValLink" data-pltdoc="x">any->response</a></span>.</div><div class="SIntrapara">Users of <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValLink" data-pltdoc="x">any->response</a></span> should protect themselves by using <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span> as a contract.
If they do so, they can safely ignore the <span class="RktVal">#f</span> return case of <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValLink" data-pltdoc="x">any->response</a></span>.</div><div class="SIntrapara"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._set-any-~3eresponse%21%29%29" class="RktValLink" data-pltdoc="x">set-any->response!</a></span> replaces the global <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._any-~3eresponse%29%29" class="RktValLink" data-pltdoc="x">any->response</a></span> with the supplied argument. This
function should return the same value for <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eq%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">eq?</a></span> inputs to ensure that <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span> is
any accurate predicate. Similarly, this function should be cheap to call multiple times on the same input,
since it will be used in contract checking as well as coercion before transmission. You may want to use a
weak <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eq%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">eq?</a></span>-based hash-table to cache the results for this purpose. (See <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=hashtables.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._make-weak-hasheq%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">make-weak-hasheq</a></span>.)</div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""web"">2.3<tt> </tt><a name="(part._web)"></a><a name="(mod-path._web-server/servlet/web)"></a>Web Interaction</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fservlet%2Fweb%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web</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%2Fservlet%2Fweb%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web</span></a> library provides the primary
functions of interest for the servlet developer.</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/servlet/web..rkt)._send/back))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fback%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/back</a></span></span><span class="hspace"> </span><span class="RktVar">response</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">response</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Sends <span class="RktVar">response</span> to the client. No continuation is captured, so the servlet is done.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">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="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fback%29%29" class="RktValLink" data-pltdoc="x">send/back</a></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></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"The sum is: "</span></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252B%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">+</a></span><span class="hspace"> </span><span class="RktSym">first-number</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">second-number</span><span class="RktPn">)</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></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/servlet/web..rkt)._send/suspend))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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">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="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Captures the current continuation, stores it with <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exp%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exp</a></span> as the expiration
handler, and binds it to a URL. <span class="RktVar">make-response</span> is called with this URL and
is expected to generate a <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span>, which is sent to the client. If the
continuation URL is invoked, the captured continuation is invoked and the request is
returned from this call to <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">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="#%28def._%28%28lib._web-server%2Fservlet%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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" 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">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Enter a number"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">form</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">[</span><span class="RktVal">action</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktSym">k-url</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"Enter a number: "</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">input</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">[</span><span class="RktVal">name</span><span class="hspace"> </span><span class="RktVal">"number"</span><span class="RktVal">]</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">input</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">[</span><span class="RktVal">type</span><span class="hspace"> </span><span class="RktVal">"submit"</span><span class="RktVal">]</span><span class="RktVal">)</span><span class="RktVal">)</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></td></tr></table></blockquote></div></p></div><div class="SIntrapara">When this form is submitted by the browser, the request will be sent to the URL generated by <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span>.
Thus, the request will be “returned” from <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span> to the continuation of this call.</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/servlet/web..rkt)._send/suspend/url))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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">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="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span> but with a URL struct.</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/servlet/web..rkt)._send/suspend/dispatch))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-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 (often named <span class="RktSym">embed/url</span>) 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="https://download.racket-lang.org/docs/6.7/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.7" 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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>. Therefore, if you pass <span class="RktSym">embed/url</span> the identity function,
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span> devolves into <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span>:</div></p></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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" 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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span><span class="hspace"> </span><span class="RktSym">response-generator</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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">embed/url</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">response-generator</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">embed/url</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</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"><p><div class="SIntrapara">Use <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span> when there are multiple ‘logical’ continuations of a page.
For example, we could either add to a number or subtract from it:
</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">count-dot-com</span><span class="hspace"> </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">count-dot-com</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">embed/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></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Count!"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h2</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></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">embed/url</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._sub1%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">sub1</a></span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"-"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number-%7E3estring%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number->string</a></span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h2</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></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">embed/url</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._add1%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">add1</a></span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"+"</span><span class="RktVal">)</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><div class="SIntrapara">Notice that in this example the result of the handlers are returned to the continuation of <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>.
However, it is very common that the return value of <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span> is irrelevant in
your application and you may think of it as “embedding” value-less callbacks. Here is the same example in this style:
</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">count-dot-com</span><span class="hspace"> </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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">embed/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></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Count!"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h2</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></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">embed/url</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</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">count-dot-com</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._sub1%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">sub1</a></span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"-"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number-%7E3estring%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number->string</a></span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h2</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></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">embed/url</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</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">count-dot-com</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._add1%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">add1</a></span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"+"</span><span class="RktVal">)</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></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/servlet/web..rkt)._send/suspend/url/dispatch))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>, but with a URL struct.</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/servlet/web..rkt)._send/forward))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fforward%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/forward</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="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._clear-continuation-table%21%29%29" class="RktValLink" data-pltdoc="x">clear-continuation-table!</a></span>, then <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span>.</div></p></div><div class="SIntrapara">Use this if the user can logically go ‘forward’ in your application, but cannot go backward.</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/servlet/web..rkt)._send/finish))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Ffinish%29%29" class="RktValDef RktValLink" data-pltdoc="x">send/finish</a></span></span><span class="hspace"> </span><span class="RktVar">response</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">response</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._clear-continuation-table%21%29%29" class="RktValLink" data-pltdoc="x">clear-continuation-table!</a></span>, then <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fback%29%29" class="RktValLink" data-pltdoc="x">send/back</a></span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Use this if the user is truly ‘done’ with your application. For example, it may be used to display the post-logout page:
</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%2Fservlet%2Fweb..rkt%29._send%2Ffinish%29%29" class="RktValLink" data-pltdoc="x">send/finish</a></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">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Logged out"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace"> </span><span class="RktVal">"Thank you for using the services "</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"of the Add Two Numbers, Inc."</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></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/servlet/web..rkt)._redirect/get))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._redirect%2Fget%29%29" class="RktValDef RktValLink" data-pltdoc="x">redirect/get</a></span></span><span class="hspace"> </span>[<span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">hs</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">hs</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span> with <span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="RktValLink" data-pltdoc="x">redirect-to</a></span>, passing <span class="RktVar">hs</span> as the headers.</div></p></div><div class="SIntrapara">This implements the Post-Redirect-Get pattern.
Use this to prevent the <span class="ssansserif">Refresh</span> button from duplicating effects, such as adding items to a database.</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/servlet/web..rkt)._redirect/get/forget))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._redirect%2Fget%2Fforget%29%29" class="RktValDef RktValLink" data-pltdoc="x">redirect/get/forget</a></span></span><span class="hspace"> </span>[<span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">hs</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">hs</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fforward%29%29" class="RktValLink" data-pltdoc="x">send/forward</a></span> with <span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="RktValLink" data-pltdoc="x">redirect-to</a></span>, passing <span class="RktVar">hs</span> as the headers.</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/servlet/web..rkt)._current-servlet-continuation-expiration-handler))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._current-servlet-continuation-expiration-handler%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-servlet-continuation-expiration-handler</a></span></span></p></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span>:<span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._parameter%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">parameter/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></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%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="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Holds the expiration handler to be used when a continuation
captured in this context is expired, then looked up.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">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="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">parameterize</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._current-servlet-continuation-expiration-handler%29%29" class="RktValLink" data-pltdoc="x">current-servlet-continuation-expiration-handler</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</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">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Custom Expiration!"</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></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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="RktSym">....</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet/web..rkt)._clear-continuation-table!))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._clear-continuation-table%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">clear-continuation-table!</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Calls the servlet’s manager’s <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._clear-continuation-table%21%29%29" class="RktValLink" data-pltdoc="x">clear-continuation-table!</a></span> function. Normally, this deletes all the previously
captured continuations.</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet/web..rkt)._with-errors-to-browser))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._with-errors-to-browser%29%29" class="RktValDef RktValLink" data-pltdoc="x">with-errors-to-browser</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">send/finish-or-back</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">thunk</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">any</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">send/finish-or-back</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">thunk</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktVar">thunk</span> with an exception handler that generates an HTML error page
and calls <span class="RktVar">send/finish-or-back</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">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="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._with-errors-to-browser%29%29" class="RktValLink" data-pltdoc="x">with-errors-to-browser</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fback%29%29" class="RktValLink" data-pltdoc="x">send/back</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252F%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">/</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">get-number</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request-number</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"><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/servlet/web..rkt)._adjust-timeout!))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._adjust-timeout%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">adjust-timeout!</a></span></span><span class="hspace"> </span><span class="RktVar">t</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">t</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Calls the servlet’s manager’s <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._adjust-timeout%21%29%29" class="RktValLink" data-pltdoc="x">adjust-timeout!</a></span> function.</div></p></div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>This is deprecated and will be removed in a future release.</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/servlet/web..rkt)._continuation-url~3f))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._continuation-url~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-url?</a></span></span><span class="hspace"> </span><span class="RktVar">u</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._list%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">list/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">u</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">url?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Checks if <span class="RktVar">u</span> is a URL that refers to a continuation, if so
returns the instance id, continuation id, and nonce.</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/servlet/web..rkt)._servlet-prompt))"></a><span title="Provided from: web-server/servlet/web | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._servlet-prompt%29%29" class="RktValDef RktValLink" data-pltdoc="x">servlet-prompt</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=cont.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-prompt-tag%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-prompt-tag?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">The tag used for Web interaction continuation capture.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""web-cells"">2.4<tt> </tt><a name="(part._web-cells)"></a><a name="(mod-path._web-server/servlet/web-cells)"></a>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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fservlet%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/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%2Fservlet%2Fweb-cells%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet/web-cells</span></a> library provides the
interface to Web cells.</div><div class="SIntrapara">A Web cell is a kind of state defined relative to the <span style="font-style: italic">frame tree</span>.
The frame-tree is a mirror of the user’s browsing session. Every time a
continuation is invoked, a new frame (called the <span style="font-style: italic">current frame</span>) is
created as a child of the current frame when the continuation was captured.</div><div class="SIntrapara">You should use Web cells if you want an effect to be encapsulated in all
interactions linked from (in a transitive sense) the HTTP response being
generated. For more information on their semantics, consult the paper
<a href="http://www.cs.brown.edu/~sk/Publications/Papers/Published/mk-int-safe-state-web/">"Interaction-Safe State for the Web"</a>.</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/servlet/web-cells..rkt)._web-cell~3f))"></a><span title="Provided from: web-server/servlet/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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 web-cell.</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/servlet/web-cells..rkt)._make-web-cell))"></a><span title="Provided from: web-server/servlet/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb-cells..rkt%29._make-web-cell%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-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="#%28def._%28%28lib._web-server%2Fservlet%2Fweb-cells..rkt%29._web-cell~3f%29%29" class="RktValLink" data-pltdoc="x">web-cell?</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="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a web-cell with a default value 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/servlet/web-cells..rkt)._web-cell-ref))"></a><span title="Provided from: web-server/servlet/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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="https://download.racket-lang.org/docs/6.7/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.7" 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%2Fservlet%2Fweb-cells..rkt%29._web-cell~3f%29%29" class="RktValLink" data-pltdoc="x">web-cell?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Looks up the value of <span class="RktVar">wc</span> found in the nearest
frame.</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/servlet/web-cells..rkt)._web-cell-shadow))"></a><span title="Provided from: web-server/servlet/web-cells | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" 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%2Fservlet%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="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Binds <span class="RktVar">wc</span> to <span class="RktVar">v</span> in the current frame, shadowing any
other bindings to <span class="RktVar">wc</span> in the current frame.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Below is an extended example that demonstrates how Web cells allow
the creation of reusable Web abstractions without requiring global
transformations of the program into continuation or store passing style.
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="run.html#%28mod-path._web-server%2Finsta%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/insta</span></a></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" 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">initial-request</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">counter1</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">make-counter</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">counter2</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">make-counter</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">include1</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">include-counter</span><span class="hspace"> </span><span class="RktSym">counter1</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">include2</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">include-counter</span><span class="hspace"> </span><span class="RktSym">counter2</span><span class="RktPn">)</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%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">embed/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></td></tr><tr><td><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">"Double Counters"</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h3</span><span class="hspace"> </span><span class="RktVal">"First"</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">include1</span><span class="hspace"> </span><span class="RktSym">embed/url</span><span class="RktPn">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h3</span><span class="hspace"> </span><span class="RktVal">"Second"</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">include2</span><span class="hspace"> </span><span class="RktSym">embed/url</span><span class="RktPn">)</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></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">make-counter</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%2Fservlet%2Fweb-cells..rkt%29._make-web-cell%29%29" class="RktValLink" data-pltdoc="x">make-web-cell</a></span><span class="hspace"> </span><span class="RktVal">0</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">include-counter</span><span class="hspace"> </span><span class="RktSym">a-counter</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=cont.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._call-with-current-continuation%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">call-with-current-continuation</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._%7Ece%7Ebb%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktSym">loop</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">embed/url</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h3</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number-%7E3estring%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number->string</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb-cells..rkt%29._web-cell-ref%29%29" class="RktValLink" data-pltdoc="x">web-cell-ref</a></span><span class="hspace"> </span><span class="RktSym">a-counter</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">)</span></td></tr><tr><td><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></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym">embed/url</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">_</a></span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">last</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb-cells..rkt%29._web-cell-ref%29%29" class="RktValLink" data-pltdoc="x">web-cell-ref</a></span><span class="hspace"> </span><span class="RktSym">a-counter</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb-cells..rkt%29._web-cell-shadow%29%29" class="RktValLink" data-pltdoc="x">web-cell-shadow</a></span><span class="hspace"> </span><span class="RktSym">a-counter</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._add1%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">add1</a></span><span class="hspace"> </span><span class="RktSym">last</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">loop</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </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></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._servlet-prompt%29%29" class="RktValLink" data-pltdoc="x">servlet-prompt</a></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-source-pkg="web-server-doc" x-part-tag=""managers"">2.5<tt> </tt><a name="(part._managers)"></a>Continuation Managers</h4><p>Since Racket servlets store their continuations on the server, they take
up memory on the server. Furthermore, garbage collection can not be used
to free this memory, because there are roots outside the system: users’
browsers, bookmarks, brains, and notebooks. Therefore, some other strategy
must be used if memory usage is to be controlled. This functionality is
pluggable through the <a name="(tech._manager)"></a><span style="font-style: italic">manager</span> interface.</p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""manager"">2.5.1<tt> </tt><a name="(part._manager)"></a><a name="(mod-path._web-server/managers/manager)"></a>General</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fmanagers%2Fmanager%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/managers/manager</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">This module defines the manager interface. It is required by
the users and implementors of managers.</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="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><span class="nobreak"><a name="(def._((lib._web-server/managers/manager..rkt)._manager-continuation-peek))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager-continuation-lookup))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager-continuation-store!))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager-clear-continuations!))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager-adjust-timeout!))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager-create-instance))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._make-manager))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager~3f))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._struct~3amanager))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._manager))"></a><span title="Provided from: web-server/managers/manager | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._manager%29%29" class="RktValDef RktValLink" data-pltdoc="x">manager</a></span></span></span></td><td><span class="hspace"> </span><span class="RktPn">(</span></td><td><span class="nobreak"><span class="RktSym">create-instance</span></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">adjust-timeout!</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">clear-continuations!</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">continuation-store!</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">continuation-lookup</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">continuation-peek</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%2Fmanagers%2Fmanager..rkt%29._make-manager%29%29" class="RktValLink" data-pltdoc="x">make-manager</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">create-instance</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">adjust-timeout!</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">clear-continuations!</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym">continuation-store!</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._list%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">list/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">continuation-lookup</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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">continuation-peek</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/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.7" 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">create-instance</span> is called to initialize a instance, to hold the
continuations of one servlet session. It is passed
a function to call when the instance is expired. It runs the id of the
instance.</div></p></div><div class="SIntrapara"><span class="RktSym">adjust-timeout!</span> is a to-be-deprecated function that takes an
instance-id and a number. It is specific to the timeout-based manager
and will be removed.</div><div class="SIntrapara"><span class="RktSym">clear-continuations!</span> expires all the continuations of an instance.</div><div class="SIntrapara"><span class="RktSym">continuation-store!</span> is given an instance-id, a continuation value,
and a function to include in the exception thrown if the continuation is
looked up and has been expired. The two numbers returned are a
continuation-id and a nonce.</div><div class="SIntrapara"><span class="RktSym">continuation-lookup</span> finds the continuation value associated with
the instance-id, continuation-id, and nonce triple it is given.</div><div class="SIntrapara"><span class="RktSym">continuation-peek</span> is identical to <span class="RktSym">continuation-lookup</span> except that
its use must not affect the resource management policy decisions on the instance or
continuation accessed. It is intended to be used by debuggers and benchmarks.</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="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><span class="nobreak"><a name="(def._((lib._web-server/managers/manager..rkt)._exn~3afail~3aservlet-manager~3ano-instance-expiration-handler))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._make-exn~3afail~3aservlet-manager~3ano-instance))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._exn~3afail~3aservlet-manager~3ano-instance~3f))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._struct~3aexn~3afail~3aservlet-manager~3ano-instance))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._exn~3afail~3aservlet-manager~3ano-instance))"></a><span title="Provided from: web-server/managers/manager | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-instance%29%29" class="RktValDef RktValLink" data-pltdoc="x">exn:fail:servlet-manager:no-instance</a></span></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=exns.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._exn%7E3afail%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exn:fail</a></span></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="nobreak"><span class="RktSym">expiration-handler</span><span class="RktPn">)</span></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._make-exn~3afail~3aservlet-manager~3ano-instance%29%29" class="RktValLink" data-pltdoc="x">make-exn:fail:servlet-manager:no-instance</a></span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym">expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">This exception should be thrown by a manager when an instance is looked
up that does not exist.</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>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><span class="nobreak"><a name="(def._((lib._web-server/managers/manager..rkt)._exn~3afail~3aservlet-manager~3ano-continuation-expiration-handler))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._make-exn~3afail~3aservlet-manager~3ano-continuation))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._exn~3afail~3aservlet-manager~3ano-continuation~3f))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._struct~3aexn~3afail~3aservlet-manager~3ano-continuation))"></a><a name="(def._((lib._web-server/managers/manager..rkt)._exn~3afail~3aservlet-manager~3ano-continuation))"></a><span title="Provided from: web-server/managers/manager | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-continuation%29%29" class="RktValDef RktValLink" data-pltdoc="x">exn:fail:servlet-manager:no-continuation</a></span></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=exns.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._exn%7E3afail%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exn:fail</a></span></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="nobreak"><span class="RktSym">expiration-handler</span><span class="RktPn">)</span></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._make-exn~3afail~3aservlet-manager~3ano-continuation%29%29" class="RktValLink" data-pltdoc="x">make-exn:fail:servlet-manager:no-continuation</a></span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym">expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">This exception should be thrown by a manager when a continuation is
looked up that does not exist.</div></p></div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""none"">2.5.2<tt> </tt><a name="(part._none)"></a><a name="(mod-path._web-server/managers/none)"></a>No Continuations</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fmanagers%2Fnone%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/managers/none</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">This module defines a manager constructor:</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/managers/none..rkt)._create-none-manager))"></a><span title="Provided from: web-server/managers/none | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29" class="RktValDef RktValLink" data-pltdoc="x">create-none-manager</a></span></span><span class="hspace"> </span><span class="RktVar">instance-expiration-handler</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%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><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">This manager does not actually store any continuation or instance data.
You could use it if you know your servlet does not use the continuation
capturing functions and want the server to not allocate meta-data
structures for each instance.</div></p></div><div class="SIntrapara">If you <span style="font-style: italic">do</span> use a continuation capturing function, the continuation is
simply not stored. If the URL is visited, the <span class="RktVar">instance-expiration-handler</span>
is called with the request.</div><div class="SIntrapara">If you are considering using this manager, also consider using the
Web Language. (See <a href="stateless.html" data-pltdoc="x">Stateless Servlets</a>.)</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""timeouts"">2.5.3<tt> </tt><a name="(part._timeouts)"></a><a name="(mod-path._web-server/managers/timeouts)"></a>Timeouts</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fmanagers%2Ftimeouts%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/managers/timeouts</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">This module defines a manager constructor:</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._web-server/managers/timeouts..rkt)._create-timeout-manager))"></a><span title="Provided from: web-server/managers/timeouts | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Ftimeouts..rkt%29._create-timeout-manager%29%29" class="RktValDef RktValLink" data-pltdoc="x">create-timeout-manager</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-exp-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-timeout</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">continuation-timeout</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._manager~3f%29%29" class="RktValLink" data-pltdoc="x">manager?</a></span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-exp-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">instance-timeout</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">continuation-timeout</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Instances managed by this manager will be expired <span class="RktVar">instance-timeout</span>
seconds after the last time it is accessed. If an expired instance is
looked up, the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-instance%29%29" class="RktValLink" data-pltdoc="x">exn:fail:servlet-manager:no-instance</a></span> exception
is thrown with <span class="RktVar">instance-exp-handler</span> as the expiration handler.</div></p></div><div class="SIntrapara">Continuations managed by this manager will be expired <span class="RktVar">continuation-timeout</span>
seconds after the last time it is accessed. If an expired continuation is looked
up, the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-continuation%29%29" class="RktValLink" data-pltdoc="x">exn:fail:servlet-manager:no-continuation</a></span> exception
is thrown with <span class="RktVar">instance-exp-handler</span> as the expiration handler, if
no expiration-handler was passed to <span class="RktSym">continuation-store!</span>.</div><div class="SIntrapara"><span class="RktSym">adjust-timeout!</span> corresponds to <span class="RktSym">reset-timer!</span> on the timer
responsible for the servlet instance.</div><div class="SIntrapara">This manager has been found to be... problematic... in large-scale
deployments of the Web Server .</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-source-pkg="web-server-doc" x-part-tag=""lru"">2.5.4<tt> </tt><a name="(part._lru)"></a><a name="(mod-path._web-server/managers/lru)"></a>LRU</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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fmanagers%2Flru%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/managers/lru</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">This module defines a manager constructor:</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._web-server/managers/lru..rkt)._create-.L.R.U-manager))"></a><span title="Provided from: web-server/managers/lru | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._create-.L.R.U-manager%29%29" class="RktValDef RktValLink" data-pltdoc="x">create-LRU-manager</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">check-interval</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">collect-interval</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">collect?</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span>[</td><td valign="top"><span class="RktPn">#:initial-count</span><span class="hspace"> </span><span class="RktVar">initial-count</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktPn">#:inform-p</span><span class="hspace"> </span><span class="RktVar">inform-p</span>]<span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._manager~3f%29%29" class="RktValLink" data-pltdoc="x">manager?</a></span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">check-interval</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">integer?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">collect-interval</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">integer?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">collect?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">initial-count</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">1</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">inform-p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktStxLink Sq" data-pltdoc="x">_</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Instances managed by this manager will be expired if there are no
continuations associated with them, after the instance is unlocked.
If an expired instance is looked up, the
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-instance%29%29" class="RktValLink" data-pltdoc="x">exn:fail:servlet-manager:no-instance</a></span> exception
is thrown with <span class="RktSym">instance-exp-handler</span> as the expiration handler.</div></p></div><div class="SIntrapara">Continuations managed by this manager are given a "Life Count" of
<span class="RktVar">initial-count</span> initially. If an expired continuation is looked
up, the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._exn~3afail~3aservlet-manager~3ano-continuation%29%29" class="RktValLink" data-pltdoc="x">exn:fail:servlet-manager:no-continuation</a></span> exception
is thrown with <span class="RktSym">instance-exp-handler</span> as the expiration handler, if
no expiration-handler was passed to <span class="RktSym">continuation-store!</span>.</div><div class="SIntrapara">Every <span class="RktVar">check-interval</span> seconds <span class="RktVar">collect?</span> is called to determine
if the collection routine should be run. Every <span class="RktVar">collect-interval</span> seconds
the collection routine is run.</div><div class="SIntrapara">Every time the collection routine runs, the "Life Count" of every
continuation is decremented by <span class="RktVal">1</span>. If a continuation’s count
reaches <span class="RktVal">0</span>, it is expired. The <span class="RktVar">inform-p</span> function
is called if any continuations are expired, with the number of
continuations expired.</div><div class="SIntrapara">The recommended usage of this manager is codified as the following function:</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._web-server/managers/lru..rkt)._make-threshold-.L.R.U-manager))"></a><span title="Provided from: web-server/managers/lru | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-threshold-LRU-manager</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">memory-threshold</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._manager~3f%29%29" class="RktValLink" data-pltdoc="x">manager?</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">instance-expiration-handler</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">false/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request?</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/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.7" 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="#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._can-be-response~3f%29%29" class="RktValLink" data-pltdoc="x">can-be-response?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">memory-threshold</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">This creates an LRU manager with the following behavior:
The memory limit is set to <span class="RktVar">memory-threshold</span> bytes. Continuations start with <span class="RktVal">24</span>
life points. Life points are deducted at the rate of one every <span class="RktVal">10</span> minutes, or one
every <span class="RktVal">5</span> seconds when the memory limit is exceeded. Hence the maximum life time for
a continuation is <span class="RktVal">4</span> hours, and the minimum is <span class="RktVal">2</span> minutes.</div></p></div><div class="SIntrapara">If the load on the server spikes—<wbr></wbr>as indicated by memory usage—<wbr></wbr>the server will quickly expire
continuations, until the memory is back under control. If the load
stays low, it will still efficiently expire old continuations.</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.7", "../");" 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.7");">top</a></span><span class="navright"> <a href="run.html" title="backward to "1 Running Web Servlets"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="stateless.html" title="forward to "3 Stateless Servlets"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|