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.
- data/Rakefile +14 -6
- data/doc/rdoc/classes/ESI/CParser.html +122 -0
- data/doc/rdoc/classes/ESI/Cache.html +178 -0
- data/doc/rdoc/classes/ESI/Cache.src/M000085.html +17 -0
- data/doc/rdoc/classes/ESI/Cache.src/M000086.html +20 -0
- data/doc/rdoc/classes/ESI/Config.html +333 -0
- data/doc/rdoc/classes/ESI/Config.src/M000052.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000053.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000054.html +35 -0
- data/doc/rdoc/classes/ESI/Config.src/M000055.html +38 -0
- data/doc/rdoc/classes/ESI/Config.src/M000056.html +23 -0
- data/doc/rdoc/classes/ESI/Config.src/M000057.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000058.html +20 -0
- data/doc/rdoc/classes/ESI/Config.src/M000059.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000060.html +24 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.html +212 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000064.html +19 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000065.html +19 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000066.html +18 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000067.html +18 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000068.html +18 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.html +187 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000061.html +19 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000062.html +21 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000063.html +21 -0
- data/doc/rdoc/classes/ESI/Dispatcher.html +172 -0
- data/doc/rdoc/classes/ESI/Dispatcher.src/M000087.html +22 -0
- data/doc/rdoc/classes/ESI/Dispatcher.src/M000088.html +18 -0
- data/doc/rdoc/classes/ESI/Fragment.html +218 -0
- data/doc/rdoc/classes/ESI/Fragment.src/M000100.html +20 -0
- data/doc/rdoc/classes/ESI/Fragment.src/M000101.html +18 -0
- data/doc/rdoc/classes/ESI/Fragment.src/M000102.html +18 -0
- data/doc/rdoc/classes/ESI/Invalidator.html +131 -0
- data/doc/rdoc/classes/ESI/Invalidator.src/M000004.html +41 -0
- data/doc/rdoc/classes/ESI/Log.html +221 -0
- data/doc/rdoc/classes/ESI/Log.src/M000030.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000031.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000032.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000033.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000034.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000035.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000036.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.html +314 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000040.html +24 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000041.html +22 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000042.html +19 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000043.html +23 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000044.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000045.html +19 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000046.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000047.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000048.html +17 -0
- data/doc/rdoc/classes/ESI/Parser.html +184 -0
- data/doc/rdoc/classes/ESI/Parser.src/M000049.html +51 -0
- data/doc/rdoc/classes/ESI/Parser.src/M000050.html +39 -0
- data/doc/rdoc/classes/ESI/Parser.src/M000051.html +19 -0
- data/doc/rdoc/classes/ESI/Processor.html +194 -0
- data/doc/rdoc/classes/ESI/Processor.src/M000037.html +26 -0
- data/doc/rdoc/classes/ESI/Processor.src/M000038.html +44 -0
- data/doc/rdoc/classes/ESI/Processor.src/M000039.html +26 -0
- data/doc/rdoc/classes/ESI/Proxy.html +304 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000069.html +20 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000070.html +55 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000071.html +53 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000072.html +25 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000073.html +19 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000074.html +27 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000075.html +18 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000076.html +28 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000077.html +29 -0
- data/doc/rdoc/classes/ESI/Response.html +250 -0
- data/doc/rdoc/classes/ESI/Response.src/M000078.html +23 -0
- data/doc/rdoc/classes/ESI/Response.src/M000079.html +18 -0
- data/doc/rdoc/classes/ESI/Response.src/M000080.html +21 -0
- data/doc/rdoc/classes/ESI/Response.src/M000081.html +20 -0
- data/doc/rdoc/classes/ESI/Response.src/M000082.html +25 -0
- data/doc/rdoc/classes/ESI/Response.src/M000083.html +18 -0
- data/doc/rdoc/classes/ESI/Response.src/M000084.html +33 -0
- data/doc/rdoc/classes/ESI/Router.html +212 -0
- data/doc/rdoc/classes/ESI/Router.src/M000098.html +36 -0
- data/doc/rdoc/classes/ESI/Router.src/M000099.html +25 -0
- data/doc/rdoc/classes/ESI/RubyCache.html +278 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000089.html +20 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000090.html +20 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000091.html +20 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000092.html +22 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000093.html +18 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000094.html +22 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000095.html +18 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000096.html +18 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000097.html +18 -0
- data/doc/rdoc/classes/ESI/Tag.html +141 -0
- data/doc/rdoc/classes/ESI/Tag/Attempt.html +113 -0
- data/doc/rdoc/classes/ESI/Tag/Base.html +237 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000026.html +23 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000027.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000028.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000029.html +17 -0
- data/doc/rdoc/classes/ESI/Tag/Container.html +206 -0
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000015.html +20 -0
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000016.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000017.html +25 -0
- data/doc/rdoc/classes/ESI/Tag/Except.html +184 -0
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000018.html +21 -0
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000019.html +20 -0
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000020.html +18 -0
- data/doc/rdoc/classes/ESI/Tag/Include.html +257 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000005.html +20 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000006.html +18 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000007.html +34 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000008.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000009.html +27 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000010.html +30 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000011.html +51 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request.html +199 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000012.html +18 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000013.html +44 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.html +155 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.src/M000014.html +19 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.html +171 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000023.html +19 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000024.html +51 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000025.html +19 -0
- data/doc/rdoc/classes/ESI/Tag/Try.html +154 -0
- data/doc/rdoc/classes/ESI/Tag/Try.src/M000021.html +38 -0
- data/doc/rdoc/classes/ESI/Tag/Try.src/M000022.html +18 -0
- data/doc/rdoc/classes/MultiDirHandler.html +198 -0
- data/doc/rdoc/classes/MultiDirHandler.src/M000001.html +20 -0
- data/doc/rdoc/classes/MultiDirHandler.src/M000002.html +28 -0
- data/doc/rdoc/classes/MultiDirHandler.src/M000003.html +22 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +167 -0
- data/doc/rdoc/files/LICENSE.html +605 -0
- data/doc/rdoc/files/README.html +359 -0
- data/doc/rdoc/files/ext/esi/common_rl.html +160 -0
- data/doc/rdoc/files/ext/esi/esi_parser_c.html +101 -0
- data/doc/rdoc/files/ext/esi/parser_c.html +101 -0
- data/doc/rdoc/files/ext/esi/parser_h.html +101 -0
- data/doc/rdoc/files/ext/esi/parser_rl.html +827 -0
- data/doc/rdoc/files/ext/esi/test/common_rl.html +160 -0
- data/doc/rdoc/files/ext/esi/test/parser_c.html +101 -0
- data/doc/rdoc/files/ext/esi/test/parser_h.html +101 -0
- data/doc/rdoc/files/ext/esi/test/parser_rl.html +827 -0
- data/doc/rdoc/files/ext/esi/test/sp_c.html +101 -0
- data/doc/rdoc/files/ext/esi/test/test_c.html +101 -0
- data/doc/rdoc/files/lib/esi/cache_rb.html +119 -0
- data/doc/rdoc/files/lib/esi/config_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/dispatcher_rb.html +108 -0
- data/doc/rdoc/files/lib/esi/invalidator_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/logger_rb.html +108 -0
- data/doc/rdoc/files/lib/esi/parser_rb.html +120 -0
- data/doc/rdoc/files/lib/esi/processor_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/proxy_rb.html +123 -0
- data/doc/rdoc/files/lib/esi/response_rb.html +116 -0
- data/doc/rdoc/files/lib/esi/router_rb.html +107 -0
- data/doc/rdoc/files/lib/esi/tag/attempt_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/tag/base_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/tag/container_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/tag/except_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/tag/include_rb.html +116 -0
- data/doc/rdoc/files/lib/esi/tag/invalidate_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/tag/try_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/version_rb.html +101 -0
- data/doc/rdoc/files/lib/multi_dirhandler_rb.html +109 -0
- data/doc/rdoc/fr_class_index.html +53 -0
- data/doc/rdoc/fr_file_index.html +59 -0
- data/doc/rdoc/fr_method_index.html +128 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/ext/esi/esi_parser.c +12 -1
- data/ext/esi/parser.c +492 -3927
- data/ext/esi/parser.rl +83 -14
- data/ext/esi/test/parser.c +1587 -367
- data/ext/esi/test/parser.rl +83 -14
- data/ext/esi/test/sp.c +125 -0
- data/ext/esi/test/test.c +198 -6
- data/lib/esi/cache.rb +5 -8
- data/lib/esi/config.rb +3 -3
- data/lib/esi/dispatcher.rb +2 -4
- data/lib/esi/parser.rb +26 -13
- data/lib/esi/processor.rb +13 -35
- data/lib/esi/proxy.rb +113 -44
- data/lib/esi/response.rb +23 -55
- data/lib/esi/router.rb +0 -11
- data/lib/esi/tag/attempt.rb +2 -1
- data/lib/esi/tag/base.rb +1 -24
- data/lib/esi/tag/container.rb +40 -0
- data/lib/esi/tag/except.rb +3 -1
- data/lib/esi/tag/include.rb +53 -62
- data/lib/esi/tag/try.rb +16 -18
- data/lib/esi/version.rb +9 -0
- data/test/integration/handler_test.rb +49 -12
- data/test/integration/help.rb +12 -0
- data/test/load_test.rb +8 -4
- data/test/load_test_ab.rb +8 -0
- data/test/sample.html +31 -0
- data/test/unit/help.rb +12 -8
- data/test/unit/include_request_test.rb +14 -21
- data/test/unit/parser_test.rb +2 -1
- data/test/unit/response_test.rb +4 -8
- data/tools/rakehelp.rb +1 -1
- 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 <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
|
+
<esi:invalidate output="no">
|
103
|
+
<?xml version="1.0"?>
|
104
|
+
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
|
105
|
+
<INVALIDATION VERSION="WCS-1.1">
|
106
|
+
<OBJECT>
|
107
|
+
<BASICSELECTOR URI="/path/to/invalidate"/>
|
108
|
+
<ACTION REMOVALTTL="0"/>
|
109
|
+
<INFO VALUE="invalidating fragment test 1"/>
|
110
|
+
</OBJECT>
|
111
|
+
</INVALIDATION>
|
112
|
+
</esi:invalidate>
|
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‘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
|
+
<esi:include src="/content/1" max-age="600+600"/>
|
175
|
+
</p>
|
176
|
+
<p>
|
177
|
+
Requesting /home, might respond with the following:
|
178
|
+
</p>
|
179
|
+
<p>
|
180
|
+
<html> <head><title>Your Page</title> </head>
|
181
|
+
<body> <div class="header"><esi:include
|
182
|
+
src="/content/1 max-age="600+600"/></div>
|
183
|
+
<div>Some content</div> <div>Some more
|
184
|
+
content</div> </body> </html>
|
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
|
+
<div>hello User42</div>
|
192
|
+
</p>
|
193
|
+
<p>
|
194
|
+
And finally, MongrelESI will respond to the original client request with
|
195
|
+
the combined documents: <html> <head><title>Your
|
196
|
+
Page</title> </head> <body> <div
|
197
|
+
class="header"><div>hello User42</div></div>
|
198
|
+
<div>Some content</div> <div>Some more
|
199
|
+
content</div> </body> </html>
|
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‘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…
|
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‘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‘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 . —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 = ('"' ("\\\""| [^"])* '"');
|
92
|
+
attr_valueq2 = ("'" ("\\\'"| [^'])* "'");
|
93
|
+
|
94
|
+
# an attribute value is either single or double quoted
|
95
|
+
attr_value = ( attr_valueq1 | attr_valueq2 );
|
96
|
+
|
97
|
+
# inline tags e.g. <esi:comment text='some useless text'/> or <esi:include src='/foo/'/>, etc...
|
98
|
+
# block tags e.g. <esi:try><esi:attempt></esi:attempt></esi:try>
|
99
|
+
# NOTE: not verifying the tag nesting
|
100
|
+
esi_tags = (
|
101
|
+
start: (
|
102
|
+
# first match block start tag with no attributes
|
103
|
+
'<esi:' [a-z]+ '>' @block_start_tag -> final |
|
104
|
+
# next match either an inline or block tag with attributes
|
105
|
+
'<esi:' [a-z]+ space @see_start_tag -> start_attribute |
|
106
|
+
# finally match a closing block tag
|
107
|
+
'</esi:' [a-z]+ '>' @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 -> end_attribute |
|
112
|
+
# match the end of an inline tag, triggers start and end callbacks
|
113
|
+
space* '/>' @see_end_tag -> final |
|
114
|
+
# matching the end of a block tag, triggers start callback
|
115
|
+
'>' @see_block_start_with_attributes -> final
|
116
|
+
),
|
117
|
+
end_attribute: (
|
118
|
+
# match the attribute value and return to matching attribute start
|
119
|
+
space* attr_value @see_attribute_value -> start_attribute
|
120
|
+
)
|
121
|
+
) >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>
|