Parent

Rack::Adapter::Rails::CGIWrapper

Public Class Methods

new(request, response, *args) click to toggle source
     # File lib/rack/adapter/rails.rb, line 96
 96:           def initialize(request, response, *args)
 97:             @request  = request
 98:             @response = response
 99:             @args     = *args
100:             @input    = request.body
101: 
102:             super *args
103:           end

Public Instance Methods

args() click to toggle source

Used to wrap the normal args variable used inside CGI.

     # File lib/rack/adapter/rails.rb, line 162
162:           def args
163:             @args
164:           end
cookies() click to toggle source
     # File lib/rack/adapter/rails.rb, line 153
153:           def cookies
154:             @request.cookies
155:           end
env_table() click to toggle source

Used to wrap the normal env_table variable used inside CGI.

     # File lib/rack/adapter/rails.rb, line 167
167:           def env_table
168:             @request.env
169:           end
header(options = "text/html") click to toggle source
     # File lib/rack/adapter/rails.rb, line 105
105:           def header(options = "text/html")
106:             if options.is_a?(String)
107:               @response['Content-Type']     = options unless @response['Content-Type']
108:             else
109:               @response['Content-Length']   = options.delete('Content-Length').to_s if options['Content-Length']
110:             
111:               @response['Content-Type']     = options.delete('type') || "text/html"
112:               @response['Content-Type']    += "; charset=" + options.delete('charset') if options['charset']
113:                         
114:               @response['Content-Language'] = options.delete('language') if options['language']
115:               @response['Expires']          = options.delete('expires') if options['expires']
116: 
117:               @response.status              = options.delete('Status') if options['Status']
118:               
119:               # Convert 'cookie' header to 'Set-Cookie' headers.
120:               # Because Set-Cookie header can appear more the once in the response body, 
121:               # we store it in a line break seperated string that will be translated to
122:               # multiple Set-Cookie header by the handler.
123:               if cookie = options.delete('cookie')
124:                 cookies = []
125:                 
126:                 case cookie
127:                   when Array then cookie.each { |c| cookies << c.to_s }
128:                   when Hash  then cookie.each { |_, c| cookies << c.to_s }
129:                   else            cookies << cookie.to_s
130:                 end
131:                 
132:                 @output_cookies.each { |c| cookies << c.to_s } if @output_cookies
133:                 
134:                 @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact
135:                 # See http://groups.google.com/group/rack-devel/browse_thread/thread/e8759b91a82c5a10/a8dbd4574fe97d69?#a8dbd4574fe97d69
136:                 if Thin.ruby_18?
137:                   @response['Set-Cookie'].flatten!
138:                 else
139:                   @response['Set-Cookie'] = @response['Set-Cookie'].join("\n")
140:                 end
141:               end
142:               
143:               options.each { |k,v| @response[k] = v }
144:             end
145:             
146:             ""
147:           end
params() click to toggle source
     # File lib/rack/adapter/rails.rb, line 149
149:           def params
150:             @params ||= @request.params
151:           end
query_string() click to toggle source
     # File lib/rack/adapter/rails.rb, line 157
157:           def query_string
158:             @request.query_string
159:           end
stdinput() click to toggle source

Used to wrap the normal stdinput variable used inside CGI.

     # File lib/rack/adapter/rails.rb, line 172
172:           def stdinput
173:             @input
174:           end
stdoutput() click to toggle source
     # File lib/rack/adapter/rails.rb, line 176
176:           def stdoutput
177:             STDERR.puts "stdoutput should not be used."
178:             @response.body
179:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.