This file is indexed.

/usr/share/doc/racket/web-server/page.html is in racket-doc 6.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!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>8&nbsp;Page: Short-hand for Common Patterns</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,&quot;tocview_0&quot;);">&#9660;</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="tocviewsublistonly" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="run.html" class="tocviewlink" data-pltdoc="x">Running Web Servlets</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="servlet.html" class="tocviewlink" data-pltdoc="x">Stateful Servlets</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="stateless.html" class="tocviewlink" data-pltdoc="x">Stateless Servlets</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="http.html" class="tocviewlink" data-pltdoc="x">HTTP:<span class="mywbr"> &nbsp;</span> Hypertext Transfer Protocol</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="dispatch.html" class="tocviewlink" data-pltdoc="x">URL-<wbr></wbr>Based Dispatch</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="formlets.html" class="tocviewlink" data-pltdoc="x">Formlets:<span class="mywbr"> &nbsp;</span> Functional Form Abstraction</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="templates.html" class="tocviewlink" data-pltdoc="x">Templates:<span class="mywbr"> &nbsp;</span> Separation of View</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Page:<span class="mywbr"> &nbsp;</span> Short-<wbr></wbr>hand for Common Patterns</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="test.html" class="tocviewlink" data-pltdoc="x">Testing Servlets</a></td></tr><tr><td align="right">10&nbsp;</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><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">page</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._embed%2Furl%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">embed/<span class="mywbr"> &nbsp;</span>url</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._lambda%2Fpage%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">lambda/<span class="mywbr"> &nbsp;</span>page</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._define%2Fpage%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define/<span class="mywbr"> &nbsp;</span>page</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">current-<wbr></wbr>request</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-id%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">binding-<wbr></wbr>id/<span class="mywbr"> &nbsp;</span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-format%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">binding-<wbr></wbr>format/<span class="mywbr"> &nbsp;</span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-binding%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">get-<wbr></wbr>binding</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-bindings%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">get-<wbr></wbr>bindings</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, &quot;6.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="templates.html" title="backward to &quot;7 Templates: Separation of View&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Web Applications in Racket&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="test.html" title="forward to &quot;9 Testing Servlets&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;page&quot;">8<tt>&nbsp;</tt><a name="(part._page)"></a><a name="(mod-path._web-server/page)"></a>Page: Short-hand for Common Patterns</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.1" 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/page</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></p><p>The Web Server provides a simple utility library for building Web applications that consistent mostly of <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>-created pages and request handling.</p><p><div class="SIntrapara">Most Web applications rely heavily on <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span> and typically use the pattern:
</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="servlet.html#%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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._%7Ece%7Ebb%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">&#955;</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">my-embed/url</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">my-embed/url</span><span class="hspace">&nbsp;</span><span class="RktSym">other-page</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/page..rkt)._page))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">page</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">e</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">The <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="RktStxLink" data-pltdoc="x">page</a></span> macro automates this by expanding <span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="RktStxLink" data-pltdoc="x">page</a></span><span class="stt"> </span><span class="RktVar">e</span><span class="stt"> </span><span class="RktMeta"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> to a usage of <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span> where the syntax parameter <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._embed%2Furl%29%29" class="RktStxLink" data-pltdoc="x">embed/url</a></span> is bound to the argument of <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>.</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>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._web-server/page..rkt)._embed/url))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._embed%2Furl%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">embed/url</a></span></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">When used inside <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="RktStxLink" data-pltdoc="x">page</a></span> syntactically, a rename transformer for the procedure embedding function; otherwise, a syntax error.</div></p><p><div class="SIntrapara">A simple 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="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="RktStxLink" data-pltdoc="x">page</a></span></td></tr><tr><td><span class="hspace">&nbsp;</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">&nbsp;&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">[</span><span class="RktVal">href</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._embed%2Furl%29%29" class="RktStxLink" data-pltdoc="x">embed/url</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._%7Ece%7Ebb%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">&#955;</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"You clicked!"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktVal">]</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"Click me"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>Similarly, many Web applications make use almost exclusively of
functions that are arguments to <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._embed%2Furl%29%29" class="RktStxLink" data-pltdoc="x">embed/url</a></span> and immediately
invoke <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%2Fdispatch%29%29" class="RktValLink" data-pltdoc="x">send/suspend/dispatch</a></span>.</p><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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/page..rkt)._lambda/page))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._lambda%2Fpage%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">lambda/page</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">formals</span><span class="hspace">&nbsp;</span><span class="RktVar">e</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._web-server/page..rkt)._define/page))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._define%2Fpage%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define/page</a></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktVar">formals</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVar">e</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">The <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._lambda%2Fpage%29%29" class="RktStxLink" data-pltdoc="x">lambda/page</a></span> and <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._define%2Fpage%29%29" class="RktStxLink" data-pltdoc="x">define/page</a></span> automate this by
expanding to functions that accept a request as the first argument
(followed by any arguments specified in <span class="RktVar">formals</span>) and
immediately wrap their body in <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._page%29%29" class="RktStxLink" data-pltdoc="x">page</a></span>. This functions also
cooperate with <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-binding%29%29" class="RktValLink" data-pltdoc="x">get-binding</a></span> by binding the request to the
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="RktValLink" data-pltdoc="x">current-request</a></span> parameter.</div></p><p>The binding interface of <a href="http.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http</span></a> is powerful,
but subtle to use conveniently due to its protection against hostile
clients.</p><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>parameter</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/page..rkt)._current-request))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-request</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</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="RktPn">(</span><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-request</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">req</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">req</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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/page..rkt)._binding-id/c))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-id%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">binding-id/c</a></span></span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/page..rkt)._binding-format/c))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-format%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">binding-format/c</a></span></span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/page..rkt)._get-binding))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-binding%29%29" class="RktValDef RktValLink" data-pltdoc="x">get-binding</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span>[<span class="RktVar">req</span><span class="hspace">&nbsp;</span><span class="RktPn">#:format</span><span class="hspace">&nbsp;</span><span class="RktVar">format</span>]<span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-id%2Fc%29%29" class="RktValLink" data-pltdoc="x">binding-id/c</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">req</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</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">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="RktValLink" data-pltdoc="x">current-request</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">format</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-format%2Fc%29%29" class="RktValLink" data-pltdoc="x">binding-format/c</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">string</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/page..rkt)._get-bindings))"></a><span title="Provided from: web-server/page | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-bindings%29%29" class="RktValDef RktValLink" data-pltdoc="x">get-bindings</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span>[<span class="RktVar">req</span><span class="hspace">&nbsp;</span><span class="RktPn">#:format</span><span class="hspace">&nbsp;</span><span class="RktVar">format</span>]<span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-id%2Fc%29%29" class="RktValLink" data-pltdoc="x">binding-id/c</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">req</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</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">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="RktValLink" data-pltdoc="x">current-request</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">format</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._binding-format%2Fc%29%29" class="RktValLink" data-pltdoc="x">binding-format/c</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">string</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">The <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-binding%29%29" class="RktValLink" data-pltdoc="x">get-binding</a></span>(s) interface attempts to resolve this by
providing a powerful interface with convenient defaults.</div></p><p><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-binding%29%29" class="RktValLink" data-pltdoc="x">get-binding</a></span> extracts the first binding of a form input from a
request, while <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._get-bindings%29%29" class="RktValLink" data-pltdoc="x">get-bindings</a></span> extracts them all.</p><p>They accept a form identifier (<span class="RktVar">id</span>) as either a byte string, a
string, or a symbol. In each case, the user input is compared in a
case-sensitive way with the form input.</p><p>They accept an optional request argument (<span class="RktVar">req</span>) that defaults
to the value of the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fpage..rkt%29._current-request%29%29" class="RktValLink" data-pltdoc="x">current-request</a></span> parameter used by
<span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._lambda%2Fpage%29%29" class="RktStxLink" data-pltdoc="x">lambda/page</a></span> and <span class="RktSym"><a href="#%28form._%28%28lib._web-server%2Fpage..rkt%29._define%2Fpage%29%29" class="RktStxLink" data-pltdoc="x">define/page</a></span>.</p><p>Finally, they accept an optional keyword argument (<span class="RktVar">format</span>)
that specifies the desired return format. The default,
<span class="RktVal">'</span><span class="RktVal">string</span>, produces a UTF-8 string (or <span class="RktVal">#f</span> if the byte
string cannot be converted to UTF-8.) The <span class="RktVal">'</span><span class="RktVal">bytes</span> format
always produces the raw byte string. The <span class="RktVal">'</span><span class="RktVal">file</span> format
produces the file upload content (or <span class="RktVal">#f</span> if the form input was
not an uploaded file.) The <span class="RktVal">'</span><span class="RktVal">binding</span> format produces the
binding object.</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, &quot;6.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="templates.html" title="backward to &quot;7 Templates: Separation of View&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Web Applications in Racket&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="test.html" title="forward to &quot;9 Testing Servlets&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>