3. HTTP
Christian Neukirchen (2007)
Web = Série de requisições e respostas HTTP.
O resto é framework que vai por cima.
HTTP é fácil!
Requests e Responses
Monday, August 23, 2010
4. Rack
Interface comum de interação
entre Webservers e Ruby
Monday, August 23, 2010
5. OBJETOS RACK
Simplicidade extrema
Monday, August 23, 2010
6. OBJETOS RACK
Simplicidade extrema
Deve responder
a #call(env)
Monday, August 23, 2010
7. OBJETOS RACK
Simplicidade extrema
Deve responder
a #call(env)
Status HTTP
Monday, August 23, 2010
8. OBJETOS RACK
Simplicidade extrema
Deve responder
a #call(env)
Content
type
Status HTTP
Monday, August 23, 2010
9. OBJETOS RACK
Simplicidade extrema
Deve responder
a #call(env) Response
Content
body
type
Status HTTP
Monday, August 23, 2010
10. OBJETOS RACK
Simplicidade extrema
Deve responder
a #call(env) Response
Content
body
type
Status HTTP
Monday, August 23, 2010
11. OBJETOS RACK
Simplicidade extrema
Deve responder
a #call(env) Response
Content
body
type
Status HTTP
Servidor Rack
Monday, August 23, 2010
12. PROCESSOS RACK
Minimalismo Extremo!
run Proc.new {|env| [200, {"Content-
Type" => "text/html"}, ["Hello
world!!"]]}
Monday, August 23, 2010
24. Middlewares
Rack::Static
Rack::CommonLogger
Rack::Reloader
Rack::ShowExceptions
Monday, August 23, 2010
25. Middlewares - rack-contrib
Rack::Profiler - Medidor de performance de requests
Rack::StaticCache - Caching para arquivos estáticos
Rack::Config - Configurações compartilhadas por todos
middlewares
Monday, August 23, 2010
41. Rails e Rack
“rake middleware”
use Rack::Lock
useActionController::Failsafe
use Rails::Rack::Metal
use ActionController::RewindableInput
use ActionController::ParamsParser
use Rack::MethodOverride
...
Monday, August 23, 2010
42. Rails e Rack
config/environment.rb
# environment.rb
# Push Rack::BounceFavicon at the bottom
config.middleware.use Rack::BounceFavicon
# Add Lifo::Cache after
ActiveRecord::QueryCache.
# Pass { :page_cache => false } argument
to Lifo::Cache.
config.middleware.insert_after
ActiveRecord::QueryCache,
Lifo::Cache, :page_cache => false
Monday, August 23, 2010
43. Rails Middlewares
Server Middleware Rails App
Monday, August 23, 2010
44. Rails Middlewares
Server Rack::Cache Rails App
Storage
Monday, August 23, 2010