This file is indexed.

/usr/share/doc/libghc-happstack-server-doc/html/Happstack-Server-Response.html is in libghc-happstack-server-doc 7.4.6.2-3.

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

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Happstack.Server.Response</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Happstack-Server-Response.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Happstack-Server-Response.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">happstack-server-7.4.6.2: Web related tools and services.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Happstack.Server.Response</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Converting values to a <code>Response</code></a></li><li><a href="#g:2">Setting the Response Code</a></li><li><a href="#g:3">Handling if-modified-since</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Functions and classes related to generating a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> and setting the response code. For detailed instruction see the Happstack Crash Course: <a href="http://happstack.com/docs/crashcourse/HelloWorld.html#response_code">http://happstack.com/docs/crashcourse/HelloWorld.html#response_code</a></p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">class</span> <a href="#t:ToMessage">ToMessage</a> a <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><a href="#v:flatten">flatten</a> :: (<a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> f) =&gt; f a -&gt; f <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></li><li class="src short"><a href="#v:toResponseBS">toResponseBS</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></li><li class="src short"><a href="#v:ok">ok</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:noContent">noContent</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:internalServerError">internalServerError</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:badGateway">badGateway</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:badRequest">badRequest</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:unauthorized">unauthorized</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:forbidden">forbidden</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:notFound">notFound</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:prettyResponse">prettyResponse</a> :: <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:requestEntityTooLarge">requestEntityTooLarge</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a</li><li class="src short"><a href="#v:seeOther">seeOther</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> uri) =&gt; uri -&gt; res -&gt; m res</li><li class="src short"><a href="#v:found">found</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> uri) =&gt; uri -&gt; res -&gt; m res</li><li class="src short"><a href="#v:movedPermanently">movedPermanently</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> a) =&gt; a -&gt; res -&gt; m res</li><li class="src short"><a href="#v:tempRedirect">tempRedirect</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> a) =&gt; a -&gt; res -&gt; m res</li><li class="src short"><a href="#v:setResponseCode">setResponseCode</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -&gt; m ()</li><li class="src short"><a href="#v:resp">resp</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -&gt; b -&gt; m b</li><li class="src short"><a href="#v:ifModifiedSince">ifModifiedSince</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/time-1.6.0.1/Data-Time-Clock.html#t:UTCTime">UTCTime</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Request">Request</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></li></ul></div><div id="interface"><h1 id="g:1">Converting values to a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code></h1><div class="top"><p class="src"><span class="keyword">class</span> <a id="t:ToMessage" class="def">ToMessage</a> a <span class="keyword">where</span> <a href="src/Happstack-Server-Response.html#ToMessage" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></p><div class="doc"><p><code><a href="Happstack-Server-Response.html#v:toResponse">toResponse</a></code> will convert a value into a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> body,
 set the <code>content-type</code>, and set the default response code for that type.</p><p><code>happstack-server</code> Example:</p><pre>main = simpleHTTP nullConf $ toResponse &quot;hello, world!&quot;</pre><p>will generate a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> with the content-type <code>text/plain</code>,
 the response code <code>200 OK</code>, and the body: <code>hello, world!</code>.</p><p><code>simpleHTTP</code> will call <code><a href="Happstack-Server-Response.html#v:toResponse">toResponse</a></code> automatically, so the above can be shortened to:</p><pre>main = simpleHTTP nullConf $ &quot;hello, world!&quot;</pre><p><code>happstack-lite</code> Example:</p><pre>main = serve Nothing $ toResponse &quot;hello, world!&quot;</pre><p>Minimal definition: <code><a href="Happstack-Server-Response.html#v:toMessage">toMessage</a></code> (and usually <code><a href="Happstack-Server-Response.html#v:toContentType">toContentType</a></code>).</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:toContentType" class="def">toContentType</a> :: a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a id="v:toMessage" class="def">toMessage</a> :: a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a id="v:toResponse" class="def">toResponse</a> :: a -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div><div class="subs instances"><p id="control.i:ToMessage" class="caption collapser" onclick="toggleSection('i:ToMessage')">Instances</p><div id="section.i:ToMessage" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:1" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:1')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Integer">Integer</a></span> <a href="src/Happstack-Server-Response.html#line-129" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:2" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:2')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> ()</span> <a href="src/Happstack-Server-Response.html#line-113" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: () -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: () -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: () -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:3" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:3')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a></span> <a href="src/Happstack-Server-Response.html#line-117" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:4" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:4')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></span> <a href="src/Happstack-Server-Response.html#line-152" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:5" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:5')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></span> <a href="src/Happstack-Server-Response.html#line-155" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:6" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:6')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/libghc-blaze-html-doc/html/Text-Blaze-Html.html#t:Html">Html</a></span> <a href="src/Happstack-Server-Response.html#line-145" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/libghc-blaze-html-doc/html/Text-Blaze-Html.html#t:Html">Html</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/libghc-blaze-html-doc/html/Text-Blaze-Html.html#t:Html">Html</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/libghc-blaze-html-doc/html/Text-Blaze-Html.html#t:Html">Html</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:7" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:7')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/libghc-html-doc/html/Text-Html.html#t:Html">Html</a></span> <a href="src/Happstack-Server-Response.html#line-137" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:7" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/libghc-html-doc/html/Text-Html.html#t:Html">Html</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/libghc-html-doc/html/Text-Html.html#t:Html">Html</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/libghc-html-doc/html/Text-Html.html#t:Html">Html</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:8" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:8')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></span> <a href="src/Happstack-Server-Response.html#line-121" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:8" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:9" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:9')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Happstack-Server-Response.html#line-125" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:9" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:10" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:10')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/xhtml-3000.2.1/Text-XHtml-Transitional.html#t:Html">Html</a></span> <a href="src/Happstack-Server-Response.html#line-141" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:10" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/xhtml-3000.2.1/Text-XHtml-Transitional.html#t:Html">Html</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/xhtml-3000.2.1/Text-XHtml-Transitional.html#t:Html">Html</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/xhtml-3000.2.1/Text-XHtml-Transitional.html#t:Html">Html</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:11" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:11')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></span> <a href="src/Happstack-Server-Response.html#line-149" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:11" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:ToMessage:ToMessage:12" class="instance expander" onclick="toggleSection('i:ic:ToMessage:ToMessage:12')"></span> <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> a =&gt; <a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</span> <a href="src/Happstack-Server-Response.html#line-132" class="link">Source</a> <a href="#t:ToMessage" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:ToMessage:ToMessage:12" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toContentType">toContentType</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toContentType" class="link">Source</a> <a href="#v:toContentType" class="selflink">#</a></p><p class="src"><a href="#v:toMessage">toMessage</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Happstack-Server-Response.html#toMessage" class="link">Source</a> <a href="#v:toMessage" class="selflink">#</a></p><p class="src"><a href="#v:toResponse">toResponse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#toResponse" class="link">Source</a> <a href="#v:toResponse" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:flatten" class="def">flatten</a> :: (<a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> f) =&gt; f a -&gt; f <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> <a href="src/Happstack-Server-Response.html#flatten" class="link">Source</a> <a href="#v:flatten" class="selflink">#</a></p><div class="doc"><p>alias for: <code>fmap toResponse</code></p><p>turns <code>m a</code> into <code>m <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code></code> using <code><a href="Happstack-Server-Response.html#v:toResponse">toResponse</a></code>.</p><pre>main = simpleHTTP nullConf $ flatten $ do return &quot;flatten me.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:toResponseBS" class="def">toResponseBS</a> <a href="src/Happstack-Server-Response.html#toResponseBS" class="link">Source</a> <a href="#v:toResponseBS" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>content-type</p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>response body</p></td></tr><tr><td class="src">-&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>A low-level function to build a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> from a content-type
 and a <code>ByteString</code>.</p><p>Creates a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> in a manner similar to the <code><a href="Happstack-Server-Response.html#t:ToMessage">ToMessage</a></code> class,
 but without requiring an instance declaration.</p><p>example:</p><pre>import Data.ByteString.Char8 as C
import Data.ByteString.Lazy.Char8 as L
import Happstack.Server

main = simpleHTTP nullConf $ ok $ toResponseBS (C.pack &quot;text/plain&quot;) (L.pack &quot;hello, world&quot;)</pre><p>(note: <code><a href="C.html#v:pack">pack</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy-Char8.html#v:pack">pack</a></code> only work for ascii. For unicode strings you would need to use <code>utf8-string</code>, <code>text</code>, or something similar to create a valid <code>ByteString</code>).</p></div></div><h1 id="g:2">Setting the Response Code</h1><div class="top"><p class="src"><a id="v:ok" class="def">ok</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#ok" class="link">Source</a> <a href="#v:ok" class="selflink">#</a></p><div class="doc"><p>Respond with <code>200 OK</code>.</p><pre>main = simpleHTTP nullConf $ ok &quot;Everything is OK&quot;</pre></div></div><div class="top"><p class="src"><a id="v:noContent" class="def">noContent</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#noContent" class="link">Source</a> <a href="#v:noContent" class="selflink">#</a></p><div class="doc"><p>Respond with <code>204 No Content</code></p><p>A <code>204 No Content</code> response may not contain a message-body. If you try to supply one, it will be dutifully ignored.</p><pre>main = simpleHTTP nullConf $ noContent &quot;This will be ignored.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:internalServerError" class="def">internalServerError</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#internalServerError" class="link">Source</a> <a href="#v:internalServerError" class="selflink">#</a></p><div class="doc"><p>Respond with <code>500 Internal Server Error</code>.</p><pre>main = simpleHTTP nullConf $ internalServerError &quot;Sorry, there was an internal server error.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:badGateway" class="def">badGateway</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#badGateway" class="link">Source</a> <a href="#v:badGateway" class="selflink">#</a></p><div class="doc"><p>Responds with <code>502 Bad Gateway</code>.</p><pre>main = simpleHTTP nullConf $ badGateway &quot;Bad Gateway.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:badRequest" class="def">badRequest</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#badRequest" class="link">Source</a> <a href="#v:badRequest" class="selflink">#</a></p><div class="doc"><p>Respond with <code>400 Bad Request</code>.</p><pre>main = simpleHTTP nullConf $ badRequest &quot;Bad Request.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:unauthorized" class="def">unauthorized</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#unauthorized" class="link">Source</a> <a href="#v:unauthorized" class="selflink">#</a></p><div class="doc"><p>Respond with <code>401 Unauthorized</code>.</p><pre>main = simpleHTTP nullConf $ unauthorized &quot;You are not authorized.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:forbidden" class="def">forbidden</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#forbidden" class="link">Source</a> <a href="#v:forbidden" class="selflink">#</a></p><div class="doc"><p>Respond with <code>403 Forbidden</code>.</p><pre>main = simpleHTTP nullConf $ forbidden &quot;Sorry, it is forbidden.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:notFound" class="def">notFound</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#notFound" class="link">Source</a> <a href="#v:notFound" class="selflink">#</a></p><div class="doc"><p>Respond with <code>404 Not Found</code>.</p><pre>main = simpleHTTP nullConf $ notFound &quot;What you are looking for has not been found.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:prettyResponse" class="def">prettyResponse</a> :: <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> <a href="src/Happstack-Server-Response.html#prettyResponse" class="link">Source</a> <a href="#v:prettyResponse" class="selflink">#</a></p><div class="doc"><p>A nicely formatted rendering of a <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code></p></div></div><div class="top"><p class="src"><a id="v:requestEntityTooLarge" class="def">requestEntityTooLarge</a> :: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m =&gt; a -&gt; m a <a href="src/Happstack-Server-Response.html#requestEntityTooLarge" class="link">Source</a> <a href="#v:requestEntityTooLarge" class="selflink">#</a></p><div class="doc"><p>Respond with <code>413 Request Entity Too Large</code>.</p><pre>main = simpleHTTP nullConf $ requestEntityTooLarge &quot;That's too big for me to handle.&quot;</pre></div></div><div class="top"><p class="src"><a id="v:seeOther" class="def">seeOther</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> uri) =&gt; uri -&gt; res -&gt; m res <a href="src/Happstack-Server-Response.html#seeOther" class="link">Source</a> <a href="#v:seeOther" class="selflink">#</a></p><div class="doc"><p>Respond with <code>303 See Other</code>.</p><pre>main = simpleHTTP nullConf $ seeOther &quot;http://example.org/&quot; &quot;What you are looking for is now at http://example.org/&quot;</pre><p>NOTE: The second argument of <code><a href="Happstack-Server-Response.html#v:seeOther">seeOther</a></code> is the message body which will sent to the browser. According to the HTTP 1.1 spec,</p><pre>the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).</pre><p>This is because pre-HTTP/1.1 user agents do not support 303. However, in practice you can probably just use <code>&quot;&quot;</code> as the second argument.</p></div></div><div class="top"><p class="src"><a id="v:found" class="def">found</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> uri) =&gt; uri -&gt; res -&gt; m res <a href="src/Happstack-Server-Response.html#found" class="link">Source</a> <a href="#v:found" class="selflink">#</a></p><div class="doc"><p>Respond with <code>302 Found</code>.</p><p>You probably want <code><a href="Happstack-Server-Response.html#v:seeOther">seeOther</a></code>. This method is not in popular use anymore, and is generally treated like 303 by most user-agents anyway.</p></div></div><div class="top"><p class="src"><a id="v:movedPermanently" class="def">movedPermanently</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> a) =&gt; a -&gt; res -&gt; m res <a href="src/Happstack-Server-Response.html#movedPermanently" class="link">Source</a> <a href="#v:movedPermanently" class="selflink">#</a></p><div class="doc"><p>Respond with <code>301 Moved Permanently</code>.</p><pre>main = simpleHTTP nullConf $ movedPermanently &quot;http://example.org/&quot; &quot;What you are looking for is now at http://example.org/&quot;</pre></div></div><div class="top"><p class="src"><a id="v:tempRedirect" class="def">tempRedirect</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-SURI.html#t:ToSURI">ToSURI</a> a) =&gt; a -&gt; res -&gt; m res <a href="src/Happstack-Server-Response.html#tempRedirect" class="link">Source</a> <a href="#v:tempRedirect" class="selflink">#</a></p><div class="doc"><p>Respond with <code>307 Temporary Redirect</code>.</p><pre>main = simpleHTTP nullConf $ tempRedirect &quot;http://example.org/&quot; &quot;What you are looking for is temporarily at http://example.org/&quot;</pre></div></div><div class="top"><p class="src"><a id="v:setResponseCode" class="def">setResponseCode</a> <a href="src/Happstack-Server-Response.html#setResponseCode" class="link">Source</a> <a href="#v:setResponseCode" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>response code</p></td></tr><tr><td class="src">-&gt; m ()</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Set an arbitrary return code in your response.</p><p>A filter for setting the response code. Generally you will use a
 helper function like <code><a href="Happstack-Server-Response.html#v:ok">ok</a></code> or <code><a href="Happstack-Server-Response.html#v:seeOther">seeOther</a></code>.</p><pre>main = simpleHTTP nullConf $ do setResponseCode 200
                                return &quot;Everything is OK&quot;</pre><p>see also: <code><a href="Happstack-Server-Response.html#v:resp">resp</a></code></p></div></div><div class="top"><p class="src"><a id="v:resp" class="def">resp</a> <a href="src/Happstack-Server-Response.html#resp" class="link">Source</a> <a href="#v:resp" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>response code</p></td></tr><tr><td class="src">-&gt; b</td><td class="doc"><p>value to return</p></td></tr><tr><td class="src">-&gt; m b</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Same as <code><code><a href="Happstack-Server-Response.html#v:setResponseCode">setResponseCode</a></code> status &gt;&gt; return val</code>.</p><p>Use this if you want to set a response code that does not already
 have a helper function.</p><pre>main = simpleHTTP nullConf $ resp 200 &quot;Everything is OK&quot;</pre></div></div><h1 id="g:3">Handling if-modified-since</h1><div class="top"><p class="src"><a id="v:ifModifiedSince" class="def">ifModifiedSince</a> <a href="src/Happstack-Server-Response.html#ifModifiedSince" class="link">Source</a> <a href="#v:ifModifiedSince" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/ghc-doc/html/libraries/time-1.6.0.1/Data-Time-Clock.html#t:UTCTime">UTCTime</a></td><td class="doc"><p>mod-time for the <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> (MUST NOT be later than server's time of message origination)</p></td></tr><tr><td class="src">-&gt; <a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></td><td class="doc"><p>incoming request (used to check for if-modified-since)</p></td></tr><tr><td class="src">-&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></td><td class="doc"><p>Response to send if there are modifications</p></td></tr><tr><td class="src">-&gt; <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Honor an <code>if-modified-since</code> header in a <code><a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></code>.
 If the <code><a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></code> includes the <code>if-modified-since</code> header and the
 <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> has not been modified, then return 304 (Not Modified),
 otherwise return the <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code>.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>