Skip to content
This repository
Newer
Older
100644 107 lines (83 sloc) 2.796 kb
3b9e4a1c »
2002-06-12 new ret vals from out/1
1
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
2 <erl>
3b9e4a1c »
2002-06-12 new ret vals from out/1
3
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
4 out(A) ->
20ece13a »
2004-12-02 more css hackery
5 {ssi, "TAB.inc","%%",[{"redirect", "choosen"}]}.
3b9e4a1c »
2002-06-12 new ret vals from out/1
6
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
7 </erl>
3b9e4a1c »
2002-06-12 new ret vals from out/1
8
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
9 <div id="entry">
3b9e4a1c »
2002-06-12 new ret vals from out/1
10
e35a5918 »
2004-12-09 more w3c compliance
11 <h2>Redirects</h2>
3b9e4a1c »
2002-06-12 new ret vals from out/1
12
e35a5918 »
2004-12-09 more w3c compliance
13 <p> Redirs are a powerful tool in the webapp programmer toolbox. The
14 Webserver returns a specific status code (302) and adds a
15 "Location:" header
16 to the responce headers to the Browser. The Browser then displays the new
17 page as indicated in the "Location" header.</p>
3b9e4a1c »
2002-06-12 new ret vals from out/1
18
e35a5918 »
2004-12-09 more w3c compliance
19 <p> Yaws supports a number of different forms of redirect return values
20 from the out/1 function.</p>
21 <p>
22 The code:</p>
3b9e4a1c »
2002-06-12 new ret vals from out/1
23
24 <erl>
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
25 out(_A) ->
26 {ehtml,
27 {'div', [{class,"box"}],
28 {pre,[],
29 {ssi, "redirect2.yaws",[],[]}}}}.
30 </erl>
31
32 <p> Clickable <a href="redirect2.yaws"> On this link </a> executes the
e35a5918 »
2004-12-09 more w3c compliance
33 above redirect code.</p>
3b9e4a1c »
2002-06-12 new ret vals from out/1
34
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
35 <p> The code above redirects to an external URL. The HTTP RFC mandates
e35a5918 »
2004-12-09 more w3c compliance
36 that the Loaction header must contain complete URLs, including the
37 the method, http, https etc. A very common case of redirection, is
38 a to redirect to another file on the same server. The code
39 in <a href="redirect3.yaws"> redirect3.yaws </a> shows an example of
40 a yaws redirect relative to the "current" server.
41 </p>
3b9e4a1c »
2002-06-12 new ret vals from out/1
42
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
43 <erl>
44 out(_A) ->
45 {ehtml,
46 {'div', [{class,"box"}],
47 {pre,[],
48 {ssi, "redirect3.yaws",[],[]}}}}.
3b9e4a1c »
2002-06-12 new ret vals from out/1
49 </erl>
50
51
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
52 <p> The code in <a href="redirect3.yaws"> redirect3.yaws </a> will
e35a5918 »
2004-12-09 more w3c compliance
53 do a relative redirect to the code in
54 <a href="redirect2.yaws"> redirect2.yaws </a> which in its turn
55 redirects, once again, to google. Double redirects.
56 </p>
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
57
58 <p>While working with redirects, the tool <a href="http://curl.haxx.se/">
e35a5918 »
2004-12-09 more w3c compliance
59 curl </a> is an excellent way to troubleshoot the behaviour of your
60 redirects.
61 For example:</p>
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
62
63 <div class="box">
64 <pre>
65 # curl -I http://rubin.hyber.org:8000/redirect3.yaws
66 HTTP/1.1 302 Found
67 Server: Yaws/1.49 Yet Another Web Server
68 Location: http://rubin.hyber.org:8000/redirect2.yaws
69 Date: Tue, 16 Nov 2004 20:16:01 GMT
70 Content-Type: text/html
71
72 <pre>
73 </div>
74
e35a5918 »
2004-12-09 more w3c compliance
75 <p>Where <tt> http://rubin.hyber.org:8000</tt> is where I am currently
76 testing the <a href="redirect3.yaws"> redirect3.yaws </a> code.
77 Learn and use the <a href="http://curl.haxx.se/"> curl </a>
78 web client, it may not render pictures pretty, but it sure displays
79 headers.
80 </p>
81 <br />
82
83 <p> We show one additional version of redirect code. The code in
84 <a href="redirect3.yaws"> redirect3.yaws </a> requires an absolute path.
85 If we want to supply a path relative to the current url, we can use
86 either the Redirect modifier <tt>rel_path</tt> or <tt>any_path</tt>
87 as in :
88 </p>
379666bf »
2004-01-27 documented jockes new bindings feature
89
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
90 <erl>
91 out(_A) ->
92 {ehtml,
93 {'div', [{class,"box"}],
94 {pre,[],
95 {ssi, "redirect4.yaws",[],[]}}}}.
96 </erl>
97
98 <p> <a href = "redirect4.yaws"> Clickable here </a>
e35a5918 »
2004-12-09 more w3c compliance
99 </p>
bea82617 »
2004-11-19 added log_wrap_size, configurable wrap size for all logs, fixed a bug…
100
101 </div>
102
103
104 <erl>
105 out(A) -> {ssi, "END2",[],[]}.
106 </erl>
Something went wrong with that request. Please try again.