comparison demo/prose @ 774:412ccd97ab71

url demo
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 May 2009 12:24:39 -0400
parents 74a090ff296e
children a8bdd5a0d9b0
comparison
equal deleted inserted replaced
773:74a090ff296e 774:412ccd97ab71
61 cookie.urp 61 cookie.urp
62 62
63 <p>Often, it is useful to associate persistent data with particular web clients. Ur/Web includes an easy facility for using type-safe cookies. This example shows how to use a form to set a named cookie.</p> 63 <p>Often, it is useful to associate persistent data with particular web clients. Ur/Web includes an easy facility for using type-safe cookies. This example shows how to use a form to set a named cookie.</p>
64 64
65 <p>After setting the cookie, try browsing back to this demo from the main index. The data you entered should still be there.</p> 65 <p>After setting the cookie, try browsing back to this demo from the main index. The data you entered should still be there.</p>
66
67 url.urp
68
69 <p>Up to this point, we haven't included a single URL in our source code. This may be very surprising to programmers used to working with traditional web frameworks! In Ur/Web, we avoid writing URLs explicitly wherever possible. To link to an external web page, we rely on an abstract type <tt>url</tt>. Strings can't be treated implicitly as URLs; rather, they must be "blessed" explicitly. This helps avoid some classes of code injection attacks.</p>
70
71 <p>Further, each Ur/Web application enforces a global condition on which strings are allowed as URLs. The <tt>.urp</tt> file for this demo shows an example that specifies particular rules about which URLs are allowed. You can try entering a variety of URLs on the form on the front page. Only those satisfying the <tt>allow url</tt>/<tt>deny url</tt> conditions should be permitted.</p>
66 72
67 listShop.urp 73 listShop.urp
68 74
69 <p>This example shows off algebraic datatypes, parametric polymorphism, and functors.</p> 75 <p>This example shows off algebraic datatypes, parametric polymorphism, and functors.</p>
70 76