miyagawa (owner)

Revisions

gist: 205298 Download_button fork
public
Public Clone URL: git://gist.github.com/205298.git
Embed All Files: show embed
xSGI-middleware-survey.txt #
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
Survey around middleware configuration and DSL syntaxes.
 
== Pylons
http://pylonshq.com/docs/en/0.9.7/configuration/#middleware-config
 
def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
  # The Pylons WSGI app
  app = PylonsApp()
  
  # Routing/Session/Cache Middleware
  app = RoutesMiddleware(app, config['routes.map'])
  app = SessionMiddleware(app, config)
  app = CacheMiddleware(app, config)
 
 
Paste:
http://pythonpaste.org/
middleware.append('paste.wdg_validate.WDGValidateMiddleware')
 
== Rack
http://rack.rubyforge.org/doc/classes/Rack/Builder.html
 app = Rack::Builder.new {
   use Rack::CommonLogger
   use Rack::ShowExceptions
   map "/lobster" do
     use Rack::Lint
     run Rack::Lobster.new
   end
 }
 
Or
 
 app = Rack::Builder.app do
   use Rack::CommonLogger
   lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'OK'] }
 end
 
== Django
http://docs.djangoproject.com/en/dev/topics/http/middleware/
 
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
)
 
== Rails
http://guide.rails.info/rails_on_rack.html#configuring-middleware-stack
 
# config/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