1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
|
<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>File: README</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>README</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>README
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Feb 26 13:30:02 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<h1><a href="../classes/Rack.html">Rack</a>, a modular Ruby webserver interface</h1>
<p>
<a href="../classes/Rack.html">Rack</a> provides a minimal, modular and
adaptable interface for developing web applications in Ruby. By wrapping
HTTP requests and responses in the simplest way possible, it unifies and
distills the API for web servers, web frameworks, and software in between
(the so-called middleware) into a single method call.
</p>
<p>
The exact details of this are described in the <a
href="../classes/Rack.html">Rack</a> specification, which all <a
href="../classes/Rack.html">Rack</a> applications should conform to.
</p>
<h2>Supported web servers</h2>
<p>
The included <b>handlers</b> connect all kinds of web servers to <a
href="../classes/Rack.html">Rack</a>:
</p>
<ul>
<li>Mongrel
</li>
<li>Mongrel/Swiftcore (require it before requiring rack)
</li>
<li>WEBrick
</li>
<li>FCGI
</li>
<li>CGI
</li>
<li>SCGI
</li>
<li>LiteSpeed
</li>
</ul>
<p>
These web servers include <a href="../classes/Rack.html">Rack</a> handlers
in their distributions:
</p>
<ul>
<li>Ebb
</li>
<li>Fuzed
</li>
<li>Thin
</li>
</ul>
<p>
Any valid <a href="../classes/Rack.html">Rack</a> app will run the same on
all these handlers, without changing anything.
</p>
<h2>Supported web frameworks</h2>
<p>
The included <b>adapters</b> connect <a
href="../classes/Rack.html">Rack</a> with existing Ruby web frameworks:
</p>
<ul>
<li>Camping
</li>
</ul>
<p>
These frameworks include <a href="../classes/Rack.html">Rack</a> adapters
in their distributions:
</p>
<ul>
<li>Coset
</li>
<li>Halcyon
</li>
<li>Maveric
</li>
<li>Merb
</li>
<li>Racktools::SimpleApplication
</li>
<li>Ramaze
</li>
<li>Sinatra
</li>
<li>Vintage
</li>
</ul>
<p>
Ruby on Rails can be run with the adapter included with Thin, which will be
merged into a later <a href="../classes/Rack.html">Rack</a> version.
</p>
<p>
Current links to these projects can be found at <a
href="http://ramaze.net/#other-frameworks">ramaze.net/#other-frameworks</a>
</p>
<h2>Available middleware</h2>
<p>
Between the server and the framework, <a
href="../classes/Rack.html">Rack</a> can be customized to your applications
needs using middleware, for example:
</p>
<ul>
<li><a href="../classes/Rack/URLMap.html">Rack::URLMap</a>, to route to
multiple applications inside the same process.
</li>
<li><a href="../classes/Rack/CommonLogger.html">Rack::CommonLogger</a>, for
creating Apache-style logfiles.
</li>
<li>Rack::ShowException, for catching unhandled exceptions and presenting them
in a nice and helpful way with clickable backtrace.
</li>
<li><a href="../classes/Rack/File.html">Rack::File</a>, for serving static
files.
</li>
<li>…many others!
</li>
</ul>
<p>
All these components use the same interface, which is described in detail
in the <a href="../classes/Rack.html">Rack</a> specification. You can
choose to use them exactly in the way you want.
</p>
<h2>Convenience</h2>
<p>
If you want to develop outside of existing frameworks, implement your own
ones, or develop middleware, <a href="../classes/Rack.html">Rack</a>
provides many helpers to create <a href="../classes/Rack.html">Rack</a>
applications quickly and without doing the same web stuff all over:
</p>
<ul>
<li><a href="../classes/Rack/Request.html">Rack::Request</a>, which also
provides query string parsing and multipart handling.
</li>
<li><a href="../classes/Rack/Response.html">Rack::Response</a>, for convenient
generation of HTTP replies and cookie handling.
</li>
<li><a href="../classes/Rack/MockRequest.html">Rack::MockRequest</a> and <a
href="../classes/Rack/MockResponse.html">Rack::MockResponse</a> for
efficient and quick testing of <a href="../classes/Rack.html">Rack</a>
application without real HTTP round-trips.
</li>
</ul>
<h2>rackup</h2>
<p>
rackup is a useful tool for running <a href="../classes/Rack.html">Rack</a>
applications, which uses the <a
href="../classes/Rack/Builder.html">Rack::Builder</a> DSL to configure
middleware and build up applications easily.
</p>
<p>
rackup automatically figures out the environment it is run in, and runs
your application as FastCGI, CGI, or standalone with Mongrel or
WEBrick—all from the same configuration.
</p>
<h2>Quick start</h2>
<p>
Try the lobster!
</p>
<p>
Either with the embedded WEBrick starter:
</p>
<pre>
ruby -Ilib lib/rack/lobster.rb
</pre>
<p>
Or with rackup:
</p>
<pre>
bin/rackup -Ilib example/lobster.ru
</pre>
<p>
By default, the lobster is found at <a
href="http://localhost:9292">localhost:9292</a>.
</p>
<h2>Installing with RubyGems</h2>
<p>
A Gem of <a href="../classes/Rack.html">Rack</a> is available. You can
install it with:
</p>
<pre>
gem install rack
</pre>
<p>
I also provide a local mirror of the gems (and development snapshots) at my
site:
</p>
<pre>
gem install rack --source http://chneukirchen.org/releases/gems
</pre>
<h2>History</h2>
<ul>
<li>March 3rd, 2007: First public release 0.1.
</li>
<li>May 16th, 2007: Second public release 0.2.
<ul>
<li>HTTP Basic authentication.
</li>
<li>Cookie Sessions.
</li>
<li>Static file handler.
</li>
<li>Improved <a href="../classes/Rack/Request.html">Rack::Request</a>.
</li>
<li>Improved <a href="../classes/Rack/Response.html">Rack::Response</a>.
</li>
<li>Added <a href="../classes/Rack/ShowStatus.html">Rack::ShowStatus</a>, for
better default error messages.
</li>
<li>Bug fixes in the Camping adapter.
</li>
<li>Removed Rails adapter, was too alpha.
</li>
</ul>
</li>
<li>February 26th, 2008: Third public release 0.3.
<ul>
<li>LiteSpeed handler, by Adrian Madrid.
</li>
<li>SCGI handler, by Jeremy Evans.
</li>
<li>Pool sessions, by blink.
</li>
<li>OpenID authentication, by blink.
</li>
<li>:Port and :File options for opening FastCGI sockets, by blink.
</li>
<li>Last-Modified HTTP header for <a
href="../classes/Rack/File.html">Rack::File</a>, by blink.
</li>
<li>Rack::Builder#use now accepts blocks, by Corey Jewett. (See
example/protectedlobster.ru)
</li>
<li>HTTP status 201 can contain a Content-Type and a body now.
</li>
<li>Many bugfixes, especially related to Cookie handling.
</li>
</ul>
</li>
</ul>
<h2>Contact</h2>
<p>
Please mail bugs, suggestions and patches to <<a
href="mailto:chneukirchen@gmail.com">chneukirchen@gmail.com</a>>.
</p>
<p>
Darcs repository ("darcs send" is welcome for patches): <a
href="http://chneukirchen.org/repos/rack">chneukirchen.org/repos/rack</a>
</p>
<p>
You are also welcome to join the rack channel on irc.freenode.net.
</p>
<h2>Thanks to</h2>
<ul>
<li>Michael Fellinger, for the helpful discussion, bugfixes and a better <a
href="../classes/Rack/Request.html">Rack::Request</a> interface.
</li>
<li>Adrian Madrid, for the LiteSpeed handler.
</li>
<li>Christoffer Sawicki, for the Rails adapter.
</li>
<li>Tim Fletcher, for the HTTP authentication code.
</li>
<li>Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
</li>
<li>blink for the Pool sessions, OpenID support, various tweaks, and
bugreports.
</li>
<li>Armin Ronacher, for the logo and racktools.
</li>
<li>Aredridel, for bug fixing.
</li>
<li>Gary Wright, for proposing a better <a
href="../classes/Rack/Response.html">Rack::Response</a> interface.
</li>
<li>Jonathan Buch, for improvements regarding <a
href="../classes/Rack/Response.html">Rack::Response</a>.
</li>
<li>Armin Röhrl, for tracking down bugs in the Cookie generator.
</li>
<li>Alexander Kellett for testing the Gem and reviewing the announce.
</li>
<li>Marcus Rückert, for help with configuring and debugging lighttpd.
</li>
<li>The WSGI team for the well-done and documented work they‘ve done and
<a href="../classes/Rack.html">Rack</a> builds up on.
</li>
</ul>
<h2>Copyright</h2>
<p>
Copyright (C) 2007, 2008 Christian Neukirchen <<a
href="http://purl.org/net/chneukirchen">purl.org/net/chneukirchen</a>>
</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</p>
<h2>Links</h2>
<table>
<tr><td valign="top"><a href="../classes/Rack.html">Rack</a>:</td><td><<a href="http://rack.rubyforge.org">rack.rubyforge.org</a>/>
</td></tr>
<tr><td valign="top"><a href="../classes/Rack.html">Rack</a>‘s Rubyforge project:</td><td><<a
href="http://rubyforge.org/projects/rack">rubyforge.org/projects/rack</a>>
</td></tr>
<tr><td valign="top">Camping:</td><td><<a href="http://camping.rubyforge.org">camping.rubyforge.org</a>/>
</td></tr>
<tr><td valign="top">Ramaze:</td><td><<a href="http://ramaze.rubyforge.org">ramaze.rubyforge.org</a>/>
</td></tr>
<tr><td valign="top">Maveric:</td><td><<a href="http://maveric.rubyforge.org">maveric.rubyforge.org</a>/>
</td></tr>
<tr><td valign="top">racktools:</td><td><<a
href="http://lucumr.pocoo.org/trac/repos/racktools">lucumr.pocoo.org/trac/repos/racktools</a>/>
</td></tr>
<tr><td valign="top">Christian Neukirchen:</td><td><<a href="http://chneukirchen.org">chneukirchen.org</a>/>
</td></tr>
</table>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
|