/usr/share/doc/racket/web-server/run.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <!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>1 Running Web 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="" class="tocviewselflink" data-pltdoc="x">Running Web Servlets</a></td></tr><tr><td align="right">2 </td><td><a href="servlet.html" class="tocviewlink" data-pltdoc="x">Stateful Servlets</a></td></tr><tr><td align="right">3 </td><td><a href="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>1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Running Web Servlets</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="#%28part._insta%29" class="tocviewlink" data-pltdoc="x">Instant Servlets</a></td></tr><tr><td align="right">1.2 </td><td><a href="#%28part._servlet-env%29" class="tocviewlink" data-pltdoc="x">Simple Single Servlet Servers</a></td></tr><tr><td align="right">1.3 </td><td><a href="#%28part._command-line-tools%29" class="tocviewlink" data-pltdoc="x">Command-<wbr></wbr>line Tools</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">1.1<tt> </tt></span><a href="#%28part._insta%29" class="tocsubseclink" data-pltdoc="x">Instant Servlets</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Finsta%2Finsta..rkt%29._no-web-browser%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">no-<wbr></wbr>web-<wbr></wbr>browser</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Finsta%2Finsta..rkt%29._static-files-path%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">static-<wbr></wbr>files-<wbr></wbr>path</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.2<tt> </tt></span><a href="#%28part._servlet-env%29" class="tocsubseclink" data-pltdoc="x">Simple Single Servlet Servers</a></td></tr><tr><td><span class="tocsublinknumber">1.2.1<tt> </tt></span><a href="#%28part._.Examples%29" class="tocsubseclink" data-pltdoc="x">Examples</a></td></tr><tr><td><span class="tocsublinknumber">1.2.1.1<tt> </tt></span><a href="#%28part._.Stateless_.Servlets%29" class="tocsubseclink" data-pltdoc="x">Stateless Servlets</a></td></tr><tr><td><span class="tocsublinknumber">1.2.2<tt> </tt></span><a href="#%28part._.Full_.A.P.I%29" class="tocsubseclink" data-pltdoc="x">Full API</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serve/<span class="mywbr"> </span>servlet</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.3<tt> </tt></span><a href="#%28part._command-line-tools%29" class="tocsubseclink" data-pltdoc="x">Command-<wbr></wbr>line Tools</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Web Applications in Racket"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="servlet.html" title="forward to "2 Stateful Servlets"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""run"">1<tt> </tt><a name="(part._run)"></a>Running Web Servlets</h3><p>There are a number of ways to run Web servlets.</p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""insta"">1.1<tt> </tt><a name="(part._insta)"></a><a name="(mod-path._web-server/insta)"></a>Instant Servlets</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="#%28mod-path._web-server%2Finsta%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/insta</span></a></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></p><p>The fastest way to get a servlet running in the Web server is to use the
"Insta" language in DrRacket. Enter the following into DrRacket:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="#%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="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="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">p</span><span class="hspace"> </span><span class="RktVal">"Hey out there!"</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>And press <span class="ssansserif">Run</span>. A Web browser will open up showing your new servlet.
This servlet will only be accessible from your local machine.</p><p>Behind the scenes, DrRacket has used <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span> to start a new server
that uses your <span class="RktSym">start</span> function as the servlet.
You are given the entire <a href="servlet.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet</span></a> API.</p><p>The following API is provided to customize the server instance:</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/insta/insta..rkt)._no-web-browser))"></a><span title="Provided from: web-server/insta | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Finsta%2Finsta..rkt%29._no-web-browser%29%29" class="RktValDef RktValLink" data-pltdoc="x">no-web-browser</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Calling this will instruct DrRacket to <span style="font-style: italic">not</span> start a Web browser when you press
<span class="ssansserif">Run</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/insta/insta..rkt)._static-files-path))"></a><span title="Provided from: web-server/insta | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Finsta%2Finsta..rkt%29._static-files-path%29%29" class="RktValDef RktValLink" data-pltdoc="x">static-files-path</a></span></span><span class="hspace"> </span><span class="RktVar">path</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">This instructs the Web server to serve static files, such as stylesheet and images, from <span class="RktVar">path</span>.</div></p><p>If you want more control over specific parameters, keep reading about <a href="#%28mod-path._web-server%2Fservlet-env%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet-env</span></a>.</p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""servlet-env"">1.2<tt> </tt><a name="(part._servlet-env)"></a><a name="(mod-path._web-server/servlet-env)"></a>Simple Single Servlet Servers</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fservlet-env%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet-env</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></p><p>The Web Server provides a way to quickly configure and start a servlet with more customizability than <a href="#%28mod-path._web-server%2Finsta%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/insta</span></a> provides. This is provided by the <a href="#%28mod-path._web-server%2Fservlet-env%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet-env</span></a> module.</p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Examples"">1.2.1<tt> </tt><a name="(part._.Examples)"></a>Examples</h5><p><div class="SIntrapara">Here is a simple example of its use:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktSym">web-server/servlet</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">web-server/servlet-env</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="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">p</span><span class="hspace"> </span><span class="RktVal">"Hey out there!"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</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="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">start</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">Unlike the <a href="#%28mod-path._web-server%2Finsta%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/insta</span></a> language, <span class="RktSym">start</span> is not a special identifier, so we could just as well have written the example as:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktSym">web-server/servlet</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">web-server/servlet-env</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">my-app</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">p</span><span class="hspace"> </span><span class="RktVal">"Hey out there!"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</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="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>Let’s look at some of the customizations <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span> allows.</p><p><div class="SIntrapara">Suppose you’d like to change the port to something else, change the last line to:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVal">8080</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">Suppose you want to accept connections from external machines:
</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-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:listen-ip</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">By default the URL for your servlet is <span class="stt">"http://localhost:8000/servlets/standalone.rkt"</span>,
suppose you wanted it to be <span class="stt">"http://localhost:8000/hello.rkt"</span>:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:servlet-path</span><span class="hspace"> </span><span class="RktVal">"/hello.rkt"</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">Suppose you wanted it to capture top-level requests:
</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-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:servlet-regexp</span><span class="hspace"> </span><span class="RktVal">#rx""</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Or, perhaps just some nice top-level name:
</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-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:servlet-path</span><span class="hspace"> </span><span class="RktVal">"/main"</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">Suppose you wanted to use a style-sheet (<span class="stt">"style.css"</span>) found on your Desktop (<span class="stt">"/Users/jay/Desktop/"</span>):
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-files-paths</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span><span class="hspace"> </span><span class="RktVal">"/Users/jay/Desktop"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">These files are served <span style="font-style: italic">in addition</span> to those from the <span class="RktPn">#:server-root-path</span> <span class="stt">"htdocs"</span> directory.
You may pass any number of extra paths.</div></p><p><div class="SIntrapara">If you want to use <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span> in a start up script for a Web application,
and don’t want a browser opened or the DrRacket banner printed, then you can write:
</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-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">my-app</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:command-line?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Stateless_Servlets"">1.2.1.1<tt> </tt><a name="(part._.Stateless_.Servlets)"></a>Stateless Servlets</h5><p><div class="SIntrapara">Suppose you would like to start a server for a stateless Web servlet <span class="stt">"servlet.rkt"</span> that provides <span class="RktSym">start</span>:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktVal">"servlet.rkt"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">web-server/servlet-env</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="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktPn">#:stateless?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">You can also put the call to <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span> in the <a href="stateless.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a> module directly:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="stateless.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktSym">web-server/servlet-env</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">send/suspend</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k-url</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">[</span><span class="RktVal">href</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktSym">k-url</span><span class="RktVal">]</span><span class="RktVal">)</span><span class="hspace"> </span><span class="RktVal">"Hello world!"</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><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span><span class="hspace"> </span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktPn">#:stateless?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Like always, you don’t even need to save the file.</div></p><h5 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""Full_API"">1.2.2<tt> </tt><a name="(part._.Full_.A.P.I)"></a>Full API</h5><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 colspan="3"><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet-env..rkt)._serve/servlet))"></a><span title="Provided from: web-server/servlet-env | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValDef RktValLink" data-pltdoc="x">serve/servlet</a></span></span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">start</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:command-line?</span><span class="hspace"> </span><span class="RktVar">command-line?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:connection-close?</span><span class="hspace"> </span><span class="RktVar">connection-close?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:launch-browser?</span><span class="hspace"> </span><span class="RktVar">launch-browser?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:quit?</span><span class="hspace"> </span><span class="RktVar">quit?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:banner?</span><span class="hspace"> </span><span class="RktVar">banner?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:listen-ip</span><span class="hspace"> </span><span class="RktVar">listen-ip</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVar">port</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:max-waiting</span><span class="hspace"> </span><span class="RktVar">max-waiting</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlet-path</span><span class="hspace"> </span><span class="RktVar">servlet-path</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlet-regexp</span><span class="hspace"> </span><span class="RktVar">servlet-regexp</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:stateless?</span><span class="hspace"> </span><span class="RktVar">stateless?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:stuffer</span><span class="hspace"> </span><span class="RktVar">stuffer</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:manager</span><span class="hspace"> </span><span class="RktVar">manager</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlet-namespace</span><span class="hspace"> </span><span class="RktVar">servlet-namespace</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:server-root-path</span><span class="hspace"> </span><span class="RktVar">server-root-path</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:extra-files-paths</span><span class="hspace"> </span><span class="RktVar">extra-files-paths</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlets-root</span><span class="hspace"> </span><span class="RktVar">servlets-root</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlet-current-directory</span><span class="hspace"> </span><span class="RktVar">servlet-current-directory</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:file-not-found-responder</span><span class="hspace"> </span><span class="RktVar">file-not-found-responder</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlet-loading-responder</span><span class="hspace"> </span><span class="RktVar">responders-servlet-loading</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:servlet-responder</span><span class="hspace"> </span><span class="RktVar">responders-servlet</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:mime-types-path</span><span class="hspace"> </span><span class="RktVar">mime-types-path</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ssl?</span><span class="hspace"> </span><span class="RktVar">ssl?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ssl-cert</span><span class="hspace"> </span><span class="RktVar">ssl-cert</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ssl-key</span><span class="hspace"> </span><span class="RktVar">ssl-key</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:log-file</span><span class="hspace"> </span><span class="RktVar">log-file</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:log-format</span><span class="hspace"> </span><span class="RktVar">log-format</span>]<span class="RktPn">)</span></td><td><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="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">start</span><span class="hspace"> </span>:<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="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="servlet.html#%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><tr><td><span class="hspace"> </span><span class="RktVar">command-line?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">connection-close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">launch-browser?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._not%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">not</a></span><span class="hspace"> </span><span class="RktVar">command-line?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">quit?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._not%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">not</a></span><span class="hspace"> </span><span class="RktVar">command-line?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">banner?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._not%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">not</a></span><span class="hspace"> </span><span class="RktVar">command-line?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">listen-ip</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">"127.0.0.1"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=unstable&rel=contract.html%23%2528def._%2528%2528lib._unstable%252Fcontract..rkt%2529._tcp-listen-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">tcp-listen-port?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">8000</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">max-waiting</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">511</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">servlet-path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">"/servlets/standalone.rkt"</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">servlet-regexp</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=regexp.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._regexp%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">regexp?</a></span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=regexp.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._regexp%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">regexp</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._format%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">format</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"^~a$"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=regexp.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._regexp-quote%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">regexp-quote</a></span><span class="hspace"> </span><span class="RktVar">servlet-path</span><span class="RktPn">)</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">stateless?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">stuffer</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stateless.html#%28def._%28%28lib._web-server%2Fstuffers%2Fstuffer..rkt%29._stuffer%2Fc%29%29" class="RktValLink" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="stateless.html#%28def._%28%28lib._web-server%2Flang%2Fstuff-url..rkt%29._default-stuffer%29%29" class="RktValLink" data-pltdoc="x">default-stuffer</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">manager</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Fmanager..rkt%29._manager~3f%29%29" class="RktValLink" data-pltdoc="x">manager?</a></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29" class="RktValLink" data-pltdoc="x">make-threshold-LRU-manager</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252A%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">*</a></span><span class="hspace"> </span><span class="RktVal">128</span><span class="hspace"> </span><span class="RktVal">1024</span><span class="hspace"> </span><span class="RktVal">1024</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">servlet-namespace</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Module_Names_and_Loading.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._module-path%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">module-path?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">server-root-path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym">default-server-root-path</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">extra-files-paths</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span><span class="hspace"> </span><span class="RktVar">server-root-path</span><span class="hspace"> </span><span class="RktVal">"htdocs"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">servlets-root</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span><span class="hspace"> </span><span class="RktVar">server-root-path</span><span class="hspace"> </span><span class="RktVal">"htdocs"</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">servlet-current-directory</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVar">servlets-root</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">file-not-found-responder</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="servlet.html#%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><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528def._%2528%2528lib._web-server%252Fconfiguration%252Fresponders..rkt%2529._gen-file-not-found-responder%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">gen-file-not-found-responder</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">server-root-path</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"conf"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"not-found.html"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">responders-servlet-loading</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="servlet.html#%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><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528def._%2528%2528lib._web-server%252Fconfiguration%252Fresponders..rkt%2529._servlet-loading-responder%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">servlet-loading-responder</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">responders-servlet</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="servlet.html#%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><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528def._%2528%2528lib._web-server%252Fconfiguration%252Fresponders..rkt%2529._servlet-error-responder%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">servlet-error-responder</a></span></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mime-types-path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">ssl-cert</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._and%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">and</a></span><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span><span class="hspace"> </span><span class="RktVar">server-root-path</span><span class="hspace"> </span><span class="RktVal">"server-cert.pem"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">ssl-key</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._and%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">and</a></span><span class="hspace"> </span><span class="RktVar">ssl?</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._build-path%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">build-path</a></span><span class="hspace"> </span><span class="RktVar">server-root-path</span><span class="hspace"> </span><span class="RktVal">"private-key.pem"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">log-file</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">log-format</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=dispatch-log.html%23%2528def._%2528%2528lib._web-server%252Fdispatchers%252Fdispatch-log..rkt%2529._log-format%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">log-format/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=dispatch-log.html%23%2528def._%2528%2528lib._web-server%252Fdispatchers%252Fdispatch-log..rkt%2529._format-req%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">format-req/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktVal">'</span><span class="RktVal">apache-default</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">This sets up and starts a fairly default server instance.</div></p><p><span class="RktVar">start</span> is loaded as a servlet and responds to requests that match <span class="RktVar">servlet-regexp</span>. The current directory
of servlet execution is <span class="RktVar">servlet-current-directory</span>.</p><p>If <span class="RktVar">launch-browser?</span> is true, then a web browser is opened to <span class="stt">"http://localhost:<port><servlet-path>"</span>. <span class="RktVar">servlet-path</span> has no other purpose, if <span class="RktVar">servlet-regexp</span> is provided.</p><p>If <span class="RktVar">quit?</span> is true, then the URL <span class="stt">"/quit"</span> ends the server.</p><p><div class="SIntrapara">If <span class="RktVar">stateless?</span> is true, then the servlet is run as a stateless </div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="stateless.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a></p></blockquote></div><div class="SIntrapara"> module and <span class="RktVar">stuffer</span> is used
as the <a href="stateless.html#%28tech._stuffer%29" class="techoutside" data-pltdoc="x"><span class="techinside">stuffer</span></a>.</div></p><p><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span> is simpler interface over
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=web-server.html%23%2528def._%2528%2528lib._web-server%252Fservlet-dispatch..rkt%2529._serve%252Flaunch%252Fwait%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serve/launch/wait</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=web-server.html%23%2528def._%2528%2528lib._web-server%252Fservlet-dispatch..rkt%2529._dispatch%252Fservlet%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">dispatch/servlet</a></span>, and a few of
the standard <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=dispatchers.html&version=6.1" class="Sq" data-pltdoc="x">Dispatchers</a>. Some
options, like <span class="RktVar">port</span> and <span class="RktVar">max-waiting</span> are transparently
passed to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=web-server.html%23%2528def._%2528%2528lib._web-server%252Fservlet-dispatch..rkt%2529._serve%252Flaunch%252Fwait%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serve/launch/wait</a></span>. Some advanced customization
requires using these underlying pieces of the
<a href="stateless.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server</span></a> directly. However, many simpler
customizations do not, which the rest of this section describes.</p><p>The server listens on <span class="RktVar">listen-ip</span> and port <span class="RktVar">port</span>. If <span class="RktVar">listen-ip</span> is <span class="RktVal">#f</span>, then the server accepts
connections to all of the listening machine’s addresses. Otherwise, the server accepts connections only at the interface(s) associated with the given string.
For example, providing <span class="RktVal">"127.0.0.1"</span> (the default) as <span class="RktVar">listen-ip</span> creates a server that accepts only connections to <span class="RktVal">"127.0.0.1"</span> (the loopback interface) from the local machine.</p><p>If <span class="RktVar">ssl-cert</span> and <span class="RktVar">ssl-key</span> are not false, then the server runs in HTTPS mode with <span class="RktVar">ssl-cert</span>
and <span class="RktVar">ssl-key</span> as the certificates and private keys.</p><p>The servlet is loaded with <span class="RktVar">manager</span>
as its continuation manager. (The default manager limits the amount of memory to 64 MB and
deals with memory pressure as discussed in the <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29" class="RktValLink" data-pltdoc="x">make-threshold-LRU-manager</a></span> documentation.)</p><p>The server files are rooted at <span class="RktVar">server-root-path</span> (which is the distribution root by default.)
File paths, in addition to the <span class="stt">"htdocs"</span> directory under <span class="RktVar">server-root-path</span> may be
provided with <span class="RktVar">extra-files-paths</span>. These paths are checked first, in the order they appear in the list.</p><p>Other servlets are served from <span class="RktVar">servlets-root</span>.
The modules specified by <span class="RktVar">servlet-namespace</span> are shared between servlets found in <span class="RktVar">servlets-root</span> and the current namespace (and therefore
the <span class="RktVar">start</span> procedure.)</p><p>If a file cannot be found, <span class="RktVar">file-not-found-responder</span> is used to generate an error response. If a servlet fails to load, <span class="RktVar">responders-servlet-loading</span> is used. If a servlet errors during its operation, <span class="RktVar">responders-servlet</span> is used.</p><p>If <span class="RktVar">banner?</span> is true, then an informative banner is printed. You may want to use this when
running from the command line, in which case the <span class="RktVar">command-line?</span> option controls similar options.</p><p>MIME types are looked up at <span class="RktVar">mime-types-path</span>. By default the <span class="stt">"mime.types"</span> file in the
<span class="RktVar">server-root-path</span> is used, but if that file does not exist, then the file that ships with the
Web Server is used instead. Of course, if a path is given, then it overrides this behavior.</p><p>If <span class="RktVar">log-file</span> is given, then it used to log requests using <span class="RktVar">log-format</span> as the format. Allowable formats
are those allowed by <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=dispatch-log.html%23%2528def._%2528%2528lib._web-server%252Fdispatchers%252Fdispatch-log..rkt%2529._log-format-%7E3eformat%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">log-format->format</a></span>. If <span class="RktVar">log-format</span> is a function, it is used directly to render the log entry.</p><p>If <span class="RktVar">connection-close?</span> is <span class="RktVal">#t</span>, then every connection is closed after one
request. Otherwise, the client decides based on what HTTP version it uses.</p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""command-line-tools"">1.3<tt> </tt><a name="(part._command-line-tools)"></a><a name="(idx._(gentag._0._(lib._web-server/scribblings/web-server..scrbl)))"></a>Command-line Tools</h4><p>One command-line utility is provided with the Web Server:</p><p><span class="hspace"> </span><span class="stt">plt-web-server [-f <file-name> -p <port> -a <ip-address> --ssl]</span></p><p>The optional file-name argument specifies the path to a
<span class="RktSym">configuration-table</span> S-expression (see <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528def._%2528%2528lib._web-server%252Fconfiguration%252Fconfiguration-table..rkt%2529._configuration-table-%7E3esexpr%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">configuration-table->sexpr</a></span> for the syntax documentation.)
If this is not provided, the
default configuration shipped with the server is used. The optional
port and ip-address arguments override the corresponding portions of
the <span class="RktSym">configuration-table</span>. If the SSL option is provided, then
the server uses HTTPS with <span class="stt">"server-cert.pem"</span> and <span class="stt">"private-key.pem"</span>
in the current directory, with 443 as the default port. (See the <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=openssl&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">openssl</span></a>
module for details on the SSL implementation.)</p><p>The <span class="RktSym">configuration-table</span> is given to
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528def._web-config._%2528%2528lib._web-server%252Fweb-config-unit..rkt%2529._configuration-table-%7E3eweb-config%7E40%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">configuration-table->web-config@</a></span> and used to construct a
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528form._web-config._%2528%2528lib._web-server%252Fweb-config-sig..rkt%2529._web-config%7E5e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">web-config^</a></span> unit, and is linked with the
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&rel=Web_Servers.html%23%2528def._%2528%2528lib._web-server%252Fweb-server-unit..rkt%2529._web-server%7E40%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">web-server@</a></span> unit. The resulting unit is invoked, and the
server runs until the process is killed.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Web Applications in Racket"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="servlet.html" title="forward to "2 Stateful Servlets"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|