mongrel_esi 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. data/Rakefile +14 -6
  2. data/doc/rdoc/classes/ESI/CParser.html +122 -0
  3. data/doc/rdoc/classes/ESI/Cache.html +178 -0
  4. data/doc/rdoc/classes/ESI/Cache.src/M000085.html +17 -0
  5. data/doc/rdoc/classes/ESI/Cache.src/M000086.html +20 -0
  6. data/doc/rdoc/classes/ESI/Config.html +333 -0
  7. data/doc/rdoc/classes/ESI/Config.src/M000052.html +18 -0
  8. data/doc/rdoc/classes/ESI/Config.src/M000053.html +18 -0
  9. data/doc/rdoc/classes/ESI/Config.src/M000054.html +35 -0
  10. data/doc/rdoc/classes/ESI/Config.src/M000055.html +38 -0
  11. data/doc/rdoc/classes/ESI/Config.src/M000056.html +23 -0
  12. data/doc/rdoc/classes/ESI/Config.src/M000057.html +18 -0
  13. data/doc/rdoc/classes/ESI/Config.src/M000058.html +20 -0
  14. data/doc/rdoc/classes/ESI/Config.src/M000059.html +18 -0
  15. data/doc/rdoc/classes/ESI/Config.src/M000060.html +24 -0
  16. data/doc/rdoc/classes/ESI/Config/CacheConfig.html +212 -0
  17. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000064.html +19 -0
  18. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000065.html +19 -0
  19. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000066.html +18 -0
  20. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000067.html +18 -0
  21. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000068.html +18 -0
  22. data/doc/rdoc/classes/ESI/Config/ConfigRouter.html +187 -0
  23. data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000061.html +19 -0
  24. data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000062.html +21 -0
  25. data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000063.html +21 -0
  26. data/doc/rdoc/classes/ESI/Dispatcher.html +172 -0
  27. data/doc/rdoc/classes/ESI/Dispatcher.src/M000087.html +22 -0
  28. data/doc/rdoc/classes/ESI/Dispatcher.src/M000088.html +18 -0
  29. data/doc/rdoc/classes/ESI/Fragment.html +218 -0
  30. data/doc/rdoc/classes/ESI/Fragment.src/M000100.html +20 -0
  31. data/doc/rdoc/classes/ESI/Fragment.src/M000101.html +18 -0
  32. data/doc/rdoc/classes/ESI/Fragment.src/M000102.html +18 -0
  33. data/doc/rdoc/classes/ESI/Invalidator.html +131 -0
  34. data/doc/rdoc/classes/ESI/Invalidator.src/M000004.html +41 -0
  35. data/doc/rdoc/classes/ESI/Log.html +221 -0
  36. data/doc/rdoc/classes/ESI/Log.src/M000030.html +18 -0
  37. data/doc/rdoc/classes/ESI/Log.src/M000031.html +18 -0
  38. data/doc/rdoc/classes/ESI/Log.src/M000032.html +18 -0
  39. data/doc/rdoc/classes/ESI/Log.src/M000033.html +18 -0
  40. data/doc/rdoc/classes/ESI/Log.src/M000034.html +18 -0
  41. data/doc/rdoc/classes/ESI/Log.src/M000035.html +18 -0
  42. data/doc/rdoc/classes/ESI/Log.src/M000036.html +18 -0
  43. data/doc/rdoc/classes/ESI/MemcachedCache.html +314 -0
  44. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000040.html +24 -0
  45. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000041.html +22 -0
  46. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000042.html +19 -0
  47. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000043.html +23 -0
  48. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000044.html +18 -0
  49. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000045.html +19 -0
  50. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000046.html +18 -0
  51. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000047.html +18 -0
  52. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000048.html +17 -0
  53. data/doc/rdoc/classes/ESI/Parser.html +184 -0
  54. data/doc/rdoc/classes/ESI/Parser.src/M000049.html +51 -0
  55. data/doc/rdoc/classes/ESI/Parser.src/M000050.html +39 -0
  56. data/doc/rdoc/classes/ESI/Parser.src/M000051.html +19 -0
  57. data/doc/rdoc/classes/ESI/Processor.html +194 -0
  58. data/doc/rdoc/classes/ESI/Processor.src/M000037.html +26 -0
  59. data/doc/rdoc/classes/ESI/Processor.src/M000038.html +44 -0
  60. data/doc/rdoc/classes/ESI/Processor.src/M000039.html +26 -0
  61. data/doc/rdoc/classes/ESI/Proxy.html +304 -0
  62. data/doc/rdoc/classes/ESI/Proxy.src/M000069.html +20 -0
  63. data/doc/rdoc/classes/ESI/Proxy.src/M000070.html +55 -0
  64. data/doc/rdoc/classes/ESI/Proxy.src/M000071.html +53 -0
  65. data/doc/rdoc/classes/ESI/Proxy.src/M000072.html +25 -0
  66. data/doc/rdoc/classes/ESI/Proxy.src/M000073.html +19 -0
  67. data/doc/rdoc/classes/ESI/Proxy.src/M000074.html +27 -0
  68. data/doc/rdoc/classes/ESI/Proxy.src/M000075.html +18 -0
  69. data/doc/rdoc/classes/ESI/Proxy.src/M000076.html +28 -0
  70. data/doc/rdoc/classes/ESI/Proxy.src/M000077.html +29 -0
  71. data/doc/rdoc/classes/ESI/Response.html +250 -0
  72. data/doc/rdoc/classes/ESI/Response.src/M000078.html +23 -0
  73. data/doc/rdoc/classes/ESI/Response.src/M000079.html +18 -0
  74. data/doc/rdoc/classes/ESI/Response.src/M000080.html +21 -0
  75. data/doc/rdoc/classes/ESI/Response.src/M000081.html +20 -0
  76. data/doc/rdoc/classes/ESI/Response.src/M000082.html +25 -0
  77. data/doc/rdoc/classes/ESI/Response.src/M000083.html +18 -0
  78. data/doc/rdoc/classes/ESI/Response.src/M000084.html +33 -0
  79. data/doc/rdoc/classes/ESI/Router.html +212 -0
  80. data/doc/rdoc/classes/ESI/Router.src/M000098.html +36 -0
  81. data/doc/rdoc/classes/ESI/Router.src/M000099.html +25 -0
  82. data/doc/rdoc/classes/ESI/RubyCache.html +278 -0
  83. data/doc/rdoc/classes/ESI/RubyCache.src/M000089.html +20 -0
  84. data/doc/rdoc/classes/ESI/RubyCache.src/M000090.html +20 -0
  85. data/doc/rdoc/classes/ESI/RubyCache.src/M000091.html +20 -0
  86. data/doc/rdoc/classes/ESI/RubyCache.src/M000092.html +22 -0
  87. data/doc/rdoc/classes/ESI/RubyCache.src/M000093.html +18 -0
  88. data/doc/rdoc/classes/ESI/RubyCache.src/M000094.html +22 -0
  89. data/doc/rdoc/classes/ESI/RubyCache.src/M000095.html +18 -0
  90. data/doc/rdoc/classes/ESI/RubyCache.src/M000096.html +18 -0
  91. data/doc/rdoc/classes/ESI/RubyCache.src/M000097.html +18 -0
  92. data/doc/rdoc/classes/ESI/Tag.html +141 -0
  93. data/doc/rdoc/classes/ESI/Tag/Attempt.html +113 -0
  94. data/doc/rdoc/classes/ESI/Tag/Base.html +237 -0
  95. data/doc/rdoc/classes/ESI/Tag/Base.src/M000026.html +23 -0
  96. data/doc/rdoc/classes/ESI/Tag/Base.src/M000027.html +22 -0
  97. data/doc/rdoc/classes/ESI/Tag/Base.src/M000028.html +22 -0
  98. data/doc/rdoc/classes/ESI/Tag/Base.src/M000029.html +17 -0
  99. data/doc/rdoc/classes/ESI/Tag/Container.html +206 -0
  100. data/doc/rdoc/classes/ESI/Tag/Container.src/M000015.html +20 -0
  101. data/doc/rdoc/classes/ESI/Tag/Container.src/M000016.html +22 -0
  102. data/doc/rdoc/classes/ESI/Tag/Container.src/M000017.html +25 -0
  103. data/doc/rdoc/classes/ESI/Tag/Except.html +184 -0
  104. data/doc/rdoc/classes/ESI/Tag/Except.src/M000018.html +21 -0
  105. data/doc/rdoc/classes/ESI/Tag/Except.src/M000019.html +20 -0
  106. data/doc/rdoc/classes/ESI/Tag/Except.src/M000020.html +18 -0
  107. data/doc/rdoc/classes/ESI/Tag/Include.html +257 -0
  108. data/doc/rdoc/classes/ESI/Tag/Include.src/M000005.html +20 -0
  109. data/doc/rdoc/classes/ESI/Tag/Include.src/M000006.html +18 -0
  110. data/doc/rdoc/classes/ESI/Tag/Include.src/M000007.html +34 -0
  111. data/doc/rdoc/classes/ESI/Tag/Include.src/M000008.html +22 -0
  112. data/doc/rdoc/classes/ESI/Tag/Include.src/M000009.html +27 -0
  113. data/doc/rdoc/classes/ESI/Tag/Include.src/M000010.html +30 -0
  114. data/doc/rdoc/classes/ESI/Tag/Include.src/M000011.html +51 -0
  115. data/doc/rdoc/classes/ESI/Tag/Include/Request.html +199 -0
  116. data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000012.html +18 -0
  117. data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000013.html +44 -0
  118. data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.html +155 -0
  119. data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.src/M000014.html +19 -0
  120. data/doc/rdoc/classes/ESI/Tag/Invalidate.html +171 -0
  121. data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000023.html +19 -0
  122. data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000024.html +51 -0
  123. data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000025.html +19 -0
  124. data/doc/rdoc/classes/ESI/Tag/Try.html +154 -0
  125. data/doc/rdoc/classes/ESI/Tag/Try.src/M000021.html +38 -0
  126. data/doc/rdoc/classes/ESI/Tag/Try.src/M000022.html +18 -0
  127. data/doc/rdoc/classes/MultiDirHandler.html +198 -0
  128. data/doc/rdoc/classes/MultiDirHandler.src/M000001.html +20 -0
  129. data/doc/rdoc/classes/MultiDirHandler.src/M000002.html +28 -0
  130. data/doc/rdoc/classes/MultiDirHandler.src/M000003.html +22 -0
  131. data/doc/rdoc/created.rid +1 -0
  132. data/doc/rdoc/files/COPYING.html +167 -0
  133. data/doc/rdoc/files/LICENSE.html +605 -0
  134. data/doc/rdoc/files/README.html +359 -0
  135. data/doc/rdoc/files/ext/esi/common_rl.html +160 -0
  136. data/doc/rdoc/files/ext/esi/esi_parser_c.html +101 -0
  137. data/doc/rdoc/files/ext/esi/parser_c.html +101 -0
  138. data/doc/rdoc/files/ext/esi/parser_h.html +101 -0
  139. data/doc/rdoc/files/ext/esi/parser_rl.html +827 -0
  140. data/doc/rdoc/files/ext/esi/test/common_rl.html +160 -0
  141. data/doc/rdoc/files/ext/esi/test/parser_c.html +101 -0
  142. data/doc/rdoc/files/ext/esi/test/parser_h.html +101 -0
  143. data/doc/rdoc/files/ext/esi/test/parser_rl.html +827 -0
  144. data/doc/rdoc/files/ext/esi/test/sp_c.html +101 -0
  145. data/doc/rdoc/files/ext/esi/test/test_c.html +101 -0
  146. data/doc/rdoc/files/lib/esi/cache_rb.html +119 -0
  147. data/doc/rdoc/files/lib/esi/config_rb.html +114 -0
  148. data/doc/rdoc/files/lib/esi/dispatcher_rb.html +108 -0
  149. data/doc/rdoc/files/lib/esi/invalidator_rb.html +114 -0
  150. data/doc/rdoc/files/lib/esi/logger_rb.html +108 -0
  151. data/doc/rdoc/files/lib/esi/parser_rb.html +120 -0
  152. data/doc/rdoc/files/lib/esi/processor_rb.html +115 -0
  153. data/doc/rdoc/files/lib/esi/proxy_rb.html +123 -0
  154. data/doc/rdoc/files/lib/esi/response_rb.html +116 -0
  155. data/doc/rdoc/files/lib/esi/router_rb.html +107 -0
  156. data/doc/rdoc/files/lib/esi/tag/attempt_rb.html +114 -0
  157. data/doc/rdoc/files/lib/esi/tag/base_rb.html +114 -0
  158. data/doc/rdoc/files/lib/esi/tag/container_rb.html +115 -0
  159. data/doc/rdoc/files/lib/esi/tag/except_rb.html +114 -0
  160. data/doc/rdoc/files/lib/esi/tag/include_rb.html +116 -0
  161. data/doc/rdoc/files/lib/esi/tag/invalidate_rb.html +115 -0
  162. data/doc/rdoc/files/lib/esi/tag/try_rb.html +115 -0
  163. data/doc/rdoc/files/lib/esi/version_rb.html +101 -0
  164. data/doc/rdoc/files/lib/multi_dirhandler_rb.html +109 -0
  165. data/doc/rdoc/fr_class_index.html +53 -0
  166. data/doc/rdoc/fr_file_index.html +59 -0
  167. data/doc/rdoc/fr_method_index.html +128 -0
  168. data/doc/rdoc/index.html +24 -0
  169. data/doc/rdoc/rdoc-style.css +208 -0
  170. data/ext/esi/esi_parser.c +12 -1
  171. data/ext/esi/parser.c +492 -3927
  172. data/ext/esi/parser.rl +83 -14
  173. data/ext/esi/test/parser.c +1587 -367
  174. data/ext/esi/test/parser.rl +83 -14
  175. data/ext/esi/test/sp.c +125 -0
  176. data/ext/esi/test/test.c +198 -6
  177. data/lib/esi/cache.rb +5 -8
  178. data/lib/esi/config.rb +3 -3
  179. data/lib/esi/dispatcher.rb +2 -4
  180. data/lib/esi/parser.rb +26 -13
  181. data/lib/esi/processor.rb +13 -35
  182. data/lib/esi/proxy.rb +113 -44
  183. data/lib/esi/response.rb +23 -55
  184. data/lib/esi/router.rb +0 -11
  185. data/lib/esi/tag/attempt.rb +2 -1
  186. data/lib/esi/tag/base.rb +1 -24
  187. data/lib/esi/tag/container.rb +40 -0
  188. data/lib/esi/tag/except.rb +3 -1
  189. data/lib/esi/tag/include.rb +53 -62
  190. data/lib/esi/tag/try.rb +16 -18
  191. data/lib/esi/version.rb +9 -0
  192. data/test/integration/handler_test.rb +49 -12
  193. data/test/integration/help.rb +12 -0
  194. data/test/load_test.rb +8 -4
  195. data/test/load_test_ab.rb +8 -0
  196. data/test/sample.html +31 -0
  197. data/test/unit/help.rb +12 -8
  198. data/test/unit/include_request_test.rb +14 -21
  199. data/test/unit/parser_test.rb +2 -1
  200. data/test/unit/response_test.rb +4 -8
  201. data/tools/rakehelp.rb +1 -1
  202. metadata +216 -5
@@ -0,0 +1,359 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue May 27 11:00:46 -0400 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>About</h1>
73
+ <p>
74
+ MongrelESI is meant to make caching easier by distributing the cache logic.
75
+ </p>
76
+ <p>
77
+ The idea is to represent each part of the page as a unique URL.
78
+ </p>
79
+ <p>
80
+ The whole page may not be cachable, but most of it probably is. The cache
81
+ server works by scanning the requested document for specific &lt;esi:* tags
82
+ before servering the response. MongrelESI currently, only supports a few
83
+ basic instructions
84
+ </p>
85
+ <h1>Tags</h1>
86
+ <p>
87
+ esi:include:
88
+ </p>
89
+ <pre>
90
+ src - request path, response replaces esi:include tag
91
+ timeout - how long to wait on the response
92
+ max-age - how long to cache the entity
93
+ onerror - whether continue on errors or trigger an exception
94
+ </pre>
95
+ <p>
96
+ esi:invalidate:
97
+ </p>
98
+ <pre>
99
+ encloses invalidation instructions.
100
+ these instructions currently only support basic invalidation
101
+ e.g.
102
+ &lt;esi:invalidate output=&quot;no&quot;&gt;
103
+ &lt;?xml version=&quot;1.0&quot;?&gt;
104
+ &lt;!DOCTYPE INVALIDATION SYSTEM &quot;internal:///WCSinvalidation.dtd&quot;&gt;
105
+ &lt;INVALIDATION VERSION=&quot;WCS-1.1&quot;&gt;
106
+ &lt;OBJECT&gt;
107
+ &lt;BASICSELECTOR URI=&quot;/path/to/invalidate&quot;/&gt;
108
+ &lt;ACTION REMOVALTTL=&quot;0&quot;/&gt;
109
+ &lt;INFO VALUE=&quot;invalidating fragment test 1&quot;/&gt;
110
+ &lt;/OBJECT&gt;
111
+ &lt;/INVALIDATION&gt;
112
+ &lt;/esi:invalidate&gt;
113
+
114
+ In the above example, only /path/to/invalidate will be invalidated, advanced regex style selectors are only support with ruby as the
115
+ cache storage.
116
+ </pre>
117
+ <p>
118
+ esi:try/esi:attempt/esi:except
119
+ </p>
120
+ <pre>
121
+ if any tags within the attempt block raise an exception and the onerror attribute is not equal to continue then
122
+ the server will fall back to the markup within the except block
123
+ </pre>
124
+ <h1>Proxy Config</h1>
125
+ <p>
126
+ MongrelESI is a proxy server. To configure where requests should be proxied
127
+ modify the config/routes.yml file.
128
+ </p>
129
+ <p>
130
+ Here&#8216;s an example:
131
+ </p>
132
+ <p>
133
+ ESI::Config.define(listeners) do|config|
134
+ </p>
135
+ <pre>
136
+ # define request path routing rules
137
+ config.routes do|s|
138
+ s.match( /^\/(content|samples|extras).*/ ) do|r|
139
+ r.servers = ['127.0.0.1:4000']
140
+ end
141
+ s.default do|r|
142
+ r.servers = ['127.0.0.1:3000']
143
+ end
144
+ end
145
+ </pre>
146
+ <p>
147
+ end
148
+ </p>
149
+ <p>
150
+ This sample configuration will route all urls starting with /content,
151
+ /samples, or /extras to the servers running at 127.0.0.1 on port 4000.
152
+ Everything else that matches the .* will be routed to the server running on
153
+ port 3000. Optionally the caching duration can be specificied explicity for
154
+ each host
155
+ </p>
156
+ <p>
157
+ s.default do|r|
158
+ </p>
159
+ <pre>
160
+ r.servers = ['127.0.0.1:3000']
161
+ r.cache_ttl = 300
162
+ </pre>
163
+ <p>
164
+ end
165
+ </p>
166
+ <p>
167
+ This example will cache all requests for 300 seconds, but normally you
168
+ would want to set the ttl on each individual fragment or include.
169
+ </p>
170
+ <p>
171
+ A typical include would look like the following:
172
+ </p>
173
+ <p>
174
+ &lt;esi:include src=&quot;/content/1&quot; max-age=&quot;600+600&quot;/&gt;
175
+ </p>
176
+ <p>
177
+ Requesting /home, might respond with the following:
178
+ </p>
179
+ <p>
180
+ &lt;html&gt; &lt;head&gt;&lt;title&gt;Your Page&lt;/title&gt; &lt;/head&gt;
181
+ &lt;body&gt; &lt;div class=&quot;header&quot;&gt;&lt;esi:include
182
+ src=&quot;/content/1 max-age=&quot;600+600&quot;/&gt;&lt;/div&gt;
183
+ &lt;div&gt;Some content&lt;/div&gt; &lt;div&gt;Some more
184
+ content&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;
185
+ </p>
186
+ <p>
187
+ If the uri is not already cached, the cache server will request /content/1,
188
+ which will respond with:
189
+ </p>
190
+ <p>
191
+ &lt;div&gt;hello User42&lt;/div&gt;
192
+ </p>
193
+ <p>
194
+ And finally, MongrelESI will respond to the original client request with
195
+ the combined documents: &lt;html&gt; &lt;head&gt;&lt;title&gt;Your
196
+ Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div
197
+ class=&quot;header&quot;&gt;&lt;div&gt;hello User42&lt;/div&gt;&lt;/div&gt;
198
+ &lt;div&gt;Some content&lt;/div&gt; &lt;div&gt;Some more
199
+ content&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;
200
+ </p>
201
+ <h2>Integrating with your applications</h2>
202
+ <p>
203
+ MongrelESI was built to support integrating lots of applications together.
204
+ </p>
205
+ <p>
206
+ Primarily, you&#8216;ll want to integrate by having one base application
207
+ and many tiny applications that surface within your primary application. In
208
+ the rails sense think components. In a bigger sense think multiple
209
+ application technologies all integrating into the same application. Imagine
210
+ a java application returning up to the minute chat conversations in one
211
+ part of the page, while rails delivers a reliable listing of current forum
212
+ discussion, and maybe a python presense indicator for forum posts&#8230;
213
+ </p>
214
+ <p>
215
+ One thing to keep in mind is mongrel esi is a proxy server. This means for
216
+ each request it needs to know where to route the requests. To support this
217
+ config.rb can express any regex to match a url and determine where a
218
+ request should be forwarded as well as defining a default route.
219
+ </p>
220
+ <p>
221
+ It is also sometimes convenient to allow multiple applications to store or
222
+ house static content. For this to work mongrel esi needs to know in what
223
+ directories to search for static files. This can be done by using the <a
224
+ href="../classes/MultiDirHandler.html">MultiDirHandler</a> (see
225
+ rev-config.rb)
226
+ </p>
227
+ <h2>Supported Features of ESI</h2>
228
+ <p>
229
+ From [<a href="http://www.w3.org/TR/esi-lang">www.w3.org/TR/esi-lang</a>
230
+ esi-lang]
231
+ </p>
232
+ <p>
233
+ MongrelESI supports basic include, exception handling and invalidation. It
234
+ does not include support for Variable or Conditional processing. It does
235
+ have suppport for COOKIE variables. (e.g. $(HTTP_COOKIE{name}) will be
236
+ replaced with the value of the cookie, name)
237
+ </p>
238
+ <p>
239
+ + Inclusion - ESI can compose pages by assembling included content, which
240
+ is fetched from the network.
241
+ </p>
242
+ <pre>
243
+ This allows each such fragment to have its own metadata (e.g., cacheability and handling information) seperately associated.
244
+ </pre>
245
+ <ul>
246
+ <li>Variable support - ESI 1.0 supports the use of variables based on HTTP
247
+ request attributes in a manner
248
+
249
+ <pre>
250
+ reminiscent of the Common Gateway Interface. These variables can be used by ESI statements or written directly into the processed markup.
251
+ </pre>
252
+ </li>
253
+ <li>Conditional processing - ESI allows conditional logic with Boolean
254
+ comparisons to be used to influence how a template is processed.
255
+
256
+ </li>
257
+ </ul>
258
+ <p>
259
+ + Exception and error handling - ESI provides for specification of
260
+ alternate and default resources in a number of situations.
261
+ </p>
262
+ <h2>HTTP Readings</h2>
263
+ <ul>
264
+ <li><a
265
+ href="http://www.jmarshall.com/easy/http">www.jmarshall.com/easy/http</a>/
266
+
267
+ </li>
268
+ </ul>
269
+ <h2>Adding New Features and Bug Fixing</h2>
270
+ <p>
271
+ Before adding a new feature or bug fix, it&#8216;s important to add a test
272
+ to verify the behavior.
273
+ </p>
274
+ <p>
275
+ Also, help out by keeping the Changelog updated with new features and major
276
+ bug fixes
277
+ </p>
278
+ <h2>Future ideas of improving integration</h2>
279
+ <p>
280
+ NOTE: this is a work in progress, below is how I&#8216;d like to integrate
281
+ with rails in the future
282
+ </p>
283
+ <p>
284
+ cd to/path/to/your/primary/rails/app
285
+ </p>
286
+ <p>
287
+ mongrel_esi add . &#8212;default mongrel_esi add
288
+ path/to/your/rails/secondary_app2 mongrel_esi add
289
+ path/to/your/rails/secondary_app3 mongrel_esi add
290
+ path/to/your/rails/secondary_app4
291
+ </p>
292
+ <p>
293
+ mongrel_esi start
294
+ </p>
295
+ <pre>
296
+ - starts up mongrel in each of the applications
297
+ </pre>
298
+ <h2>Credits ==</h2>
299
+ <p>
300
+ Support:
301
+ </p>
302
+ <pre>
303
+ Zed A. Shaw -- For writing [http://mongrel.rubyforge.org/ mongrel]
304
+ Adrian D. Thurston -- For writing [http://www.cs.queensu.ca/~thurston/ragel/ ragel]
305
+
306
+ The [http://www.ruby-lang.org/ ruby] community, for all their insights and help
307
+ </pre>
308
+ <p>
309
+ Author:
310
+ </p>
311
+ <pre>
312
+ Todd Fisher
313
+ </pre>
314
+ <p>
315
+ Co-Authors:
316
+ </p>
317
+ <pre>
318
+ Aaron Batalion -- Design ideas and integrating with Rails, fragment_fu. Ragel advocate
319
+ Richard Kilmer -- Thread saftey dispatcher, production ready
320
+ Adam Bair -- Writing the initial testing framework and logger.
321
+ Jeff Damick -- Writing the initial configuration.
322
+ </pre>
323
+ <p>
324
+ And of course thanks to everyone in ruby-lang for putting up with my
325
+ questions MenTaLguY for the great help in making good use of ruby
326
+ </p>
327
+
328
+ </div>
329
+
330
+
331
+ </div>
332
+
333
+
334
+ </div>
335
+
336
+
337
+ <!-- if includes -->
338
+
339
+ <div id="section">
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+ <!-- if method_list -->
349
+
350
+
351
+ </div>
352
+
353
+
354
+ <div id="validator-badges">
355
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
356
+ </div>
357
+
358
+ </body>
359
+ </html>
@@ -0,0 +1,160 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: common.rl</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>common.rl</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>ext/esi/common.rl
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jun 16 11:18:31 -0400 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ /**
74
+ </p>
75
+ <pre>
76
+ * Copyright (c) 2008 Todd A. Fisher
77
+ * see LICENSE
78
+ */
79
+ </pre>
80
+ <p>
81
+ %%{
82
+ </p>
83
+ <pre>
84
+ machine esi_common_parser;
85
+
86
+ # valid attribute key characters
87
+ attr_key = [a-zA-Z_\-]+ [a-zA-Z_\-0-9]*;
88
+
89
+ # attribute values can be contained within either double or single quotes, when single quoted then double quotes are valid
90
+ # when double quoted then single quotes are valid
91
+ attr_valueq1 = ('&quot;' (&quot;\\\&quot;&quot;| [^&quot;])* '&quot;');
92
+ attr_valueq2 = (&quot;'&quot; (&quot;\\\'&quot;| [^'])* &quot;'&quot;);
93
+
94
+ # an attribute value is either single or double quoted
95
+ attr_value = ( attr_valueq1 | attr_valueq2 );
96
+
97
+ # inline tags e.g. &lt;esi:comment text='some useless text'/&gt; or &lt;esi:include src='/foo/'/&gt;, etc...
98
+ # block tags e.g. &lt;esi:try&gt;&lt;esi:attempt&gt;&lt;/esi:attempt&gt;&lt;/esi:try&gt;
99
+ # NOTE: not verifying the tag nesting
100
+ esi_tags = (
101
+ start: (
102
+ # first match block start tag with no attributes
103
+ '&lt;esi:' [a-z]+ '&gt;' @block_start_tag -&gt; final |
104
+ # next match either an inline or block tag with attributes
105
+ '&lt;esi:' [a-z]+ space @see_start_tag -&gt; start_attribute |
106
+ # finally match a closing block tag
107
+ '&lt;/esi:' [a-z]+ '&gt;' @block_end_tag
108
+ ),
109
+ start_attribute: (
110
+ # match the attribute key up to the begining = allowing for arbitrary whitespace before the start of the key
111
+ space* attr_key '=' @see_attribute_key -&gt; end_attribute |
112
+ # match the end of an inline tag, triggers start and end callbacks
113
+ space* '/&gt;' @see_end_tag -&gt; final |
114
+ # matching the end of a block tag, triggers start callback
115
+ '&gt;' @see_block_start_with_attributes -&gt; final
116
+ ),
117
+ end_attribute: (
118
+ # match the attribute value and return to matching attribute start
119
+ space* attr_value @see_attribute_value -&gt; start_attribute
120
+ )
121
+ ) &gt;begin %finish;
122
+
123
+ main := ((/.*/)? @echo (esi_tags) )*;
124
+ </pre>
125
+ <p>
126
+ }%%
127
+ </p>
128
+
129
+ </div>
130
+
131
+
132
+ </div>
133
+
134
+
135
+ </div>
136
+
137
+
138
+ <!-- if includes -->
139
+
140
+ <div id="section">
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <!-- if method_list -->
150
+
151
+
152
+ </div>
153
+
154
+
155
+ <div id="validator-badges">
156
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
157
+ </div>
158
+
159
+ </body>
160
+ </html>