The transaction class for Arrow web applications.
Create a new Arrow::Transaction object with the specified request (an Apache::Request object), config (an Arrow::Config object), broker object (an Arrow::Broker), and session (Arrow::Session) objects.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 86
86: def initialize( request, config, broker )
87: @request = request
88: @config = config
89: @broker = broker
90: @handler_status = Apache::OK
91:
92: @serial = make_transaction_serial( request )
93:
94: # Stuff that may be filled in later
95: @session = nil # Lazily-instantiated
96: @applet_path = nil # Added by the broker
97: @vargs = nil # Filled in by the applet
98: @data = {}
99: @request_cookies = parse_cookies( request )
100: @cookies = Arrow::CookieSet.new()
101:
102: # Check for a "RubyOption root_dispatcher true"
103: if @request.options.key?('root_dispatcher') &&
104: @request.options['root_dispatcher'].match( /^(true|yes|1)$/i )
105: self.log.debug "Dispatching from root path"
106: @root_dispatcher = true
107: else
108: self.log.debug "Dispatching from sub-path"
109: @root_dispatcher = false
110: end
111:
112: super()
113: end
Add a ‘Set-Cookie’ header to the response for each cookie that currently exists the transaction‘s cookieset.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 319
319: def add_cookie_headers
320: self.cookies.each do |cookie|
321: if self.is_success?
322: self.log.debug "Adding 'Set-Cookie' header: %p (%p)" %
323: [cookie, cookie.to_s]
324: self.headers_out['Set-Cookie'] = cookie.to_s
325: else
326: self.log.debug "Adding 'Set-Cookie' to the error headers: %p (%p)" %
327: [cookie, cookie.to_s]
328: self.err_headers_out['Set-Cookie'] = cookie.to_s
329: end
330: end
331: end
Return the portion of the request‘s URI that serves as the base URI for the application. All self-referential URLs created by the application should include this.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 242
242: def app_root
243: return "" if self.root_dispatcher?
244: return @request.script_name
245: end
Returns a fully-qualified URI String to the current applet using the request object‘s server name and port.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 251
251: def app_root_url
252: return construct_url( self.app_root )
253: end
Return an absolute uri that refers back to the applet the transaction is being run in
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 259
259: def applet
260: return [ self.app_root, self.applet_path ].join("/").gsub( %r{//+}, '/' )
261: end
Returns a fully-qualified URI String to the current applet using the request object‘s server name and port.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 268
268: def applet_url
269: return construct_url( self.applet )
270: end
Get the verson of Arrow currently running.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 506
506: def arrow_version
507: return Arrow::VERSION
508: end
Set the result‘s ‘Content-Disposition’ header to ‘attachment’ and set the attachment‘s filename.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 378
378: def attachment=( filename )
379:
380: # IE flubs attachments of any mimetype it handles directly.
381: if self.browser_is_ie?
382: self.content_type = 'application/octet-stream'
383: end
384:
385: val = %q{attachment; filename="%s"} % [ filename ]
386: self.headers_out['Content-Disposition'] = val
387: end
Returns true if the User-Agent header indicates that the remote browser is Internet Explorer. Useful for making the inevitable IE workarounds.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 406
406: def browser_is_ie?
407: agent = self.headers_in['user-agent'] || ''
408: return agent =~ /MSIE/ ? true : false
409: end
Overridden from Apache::Request to take Apache mod_proxy headers into account. If the ‘X-Forwarded-Host’ or ‘X-Forwarded-Server’ headers exist in the request, the hostname specified is used instead of the canonical host.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 338
338: def construct_url( uri )
339: url = @request.construct_url( uri )
340:
341: # If the request came through a proxy, rewrite the url's host to match
342: # the hostname the proxy is forwarding for.
343: if (( host = self.proxied_host ))
344: uriobj = URI.parse( url )
345: uriobj.host = host
346: url = uriobj.to_s
347: end
348:
349: return url
350: end
Execute a block if the User-Agent header indicates that the remote browser is Internet Explorer. Useful for making the inevitable IE workarounds.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 415
415: def for_ie_users
416: yield if self.browser_is_ie?
417: end
Return true if there are HTML form parameters in the request, either in the query string with a GET request, or in the body of a POST with a mimetype of either ‘application/x-www-form-urlencoded’ or ‘multipart/form-data’.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 434
434: def form_request?
435: case self.request_method
436: when 'GET', 'HEAD', 'DELETE', 'PUT'
437: return (!self.parsed_uri.query.nil? ||
438: self.request_content_type =~ FORM_CONTENT_TYPES) ? true : false
439:
440: when 'POST'
441: return self.request_content_type =~ FORM_CONTENT_TYPES ? true : false
442:
443: else
444: return false
445: end
446: end
Returns a human-readable String representation of the transaction, suitable for debugging.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 159
159: def inspect
160: "#<%s:0x%0x serial: %s; HTTP status: %d>" % [
161: self.class.name,
162: self.object_id * 2,
163: self.serial,
164: self.status
165: ]
166: end
Return true if the request is from XMLHttpRequest (as indicated by the ‘X-Requested-With’ header from Scriptaculous or jQuery)
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 422
422: def is_ajax_request?
423: xrw_header = self.headers_in['x-requested-with']
424: return true if !xrw_header.nil? && xrw_header =~ /xmlhttprequest/i
425: return false
426: end
Returns true if the transaction‘s server status will cause the request to be declined (i.e., not handled by Arrow)
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 190
190: def is_declined?
191: self.log.debug "Checking to see if the transaction is declined (%p)" %
192: [self.handler_status]
193: return self.handler_status == Apache::DECLINED ? true : false
194: end
Returns true if the transactions response status is 2xx.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 182
182: def is_success?
183: return nil unless self.status
184: return (self.status / 100) == 2
185: end
Set the necessary header fields in the response to cause a NOT_MODIFIED response to be sent.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 487
487: def not_modified
488: return self.redirect( uri, Apache::HTTP_NOT_MODIFIED )
489: end
Return a URI object that is parsed from the request‘s URI.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 391
391: def parsed_uri
392: return URI.parse( self.request.unparsed_uri )
393: end
Returns the path operated on by the Arrow::Broker when delegating the transaction. Equal to the #uri minus the #app_root.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 232
232: def path
233: path = @request.uri
234: uripat = Regexp.new( "^" + self.app_root )
235: return path.sub( uripat, '' )
236: end
If the request came from a reverse proxy (i.e., the X-Forwarded-Host or X-Forwarded-Server headers are present), return the hostname that the proxy is forwarding for. If no proxy headers are present, return nil.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 357
357: def proxied_host
358: headers = @request.headers_in
359: return headers['x-forwarded-host'] || headers['x-forwarded-server']
360: end
Set the necessary fields in the request to cause the response to be a redirect to the given url with the specified status_code (302 by default).
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 475
475: def redirect( uri, status_code=Apache::HTTP_MOVED_TEMPORARILY )
476: self.log.debug "Redirecting to %s" % uri
477: self.headers_out[ 'Location' ] = uri.to_s
478: self.status = status_code
479: self.handler_status = Apache::REDIRECT
480:
481: return ''
482: end
Get the request‘s referer, if any
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 371
371: def referer
372: return self.headers_in['Referer']
373: end
If the referer was another applet under the same Arrow instance, return the name of the action that preceded the current one. If there was no ‘Referer’ header, or the referer wasn‘t an applet under the same Arrow instance, return nil.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 296
296: def referring_action
297: return nil unless self.referer
298: uri = URI.parse( self.referer )
299: path = uri.path or return nil
300: appletRe = Regexp.new( self.app_root + "/\\w+/" )
301:
302: return nil unless appletRe.match( path )
303: subpath = path.
304: sub( appletRe, '' ).
305: split( %r{/} ).
306: first
307:
308: return subpath
309: end
If the referer was another applet under the same Arrow instance, return the uri to it. If there was no ‘Referer’ header, or the referer wasn‘t an applet under the same Arrow instance, returns nil.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 276
276: def referring_applet
277: return nil unless self.referer
278: uri = URI.parse( self.referer )
279: path = uri.path or return nil
280: rootRe = Regexp.new( self.app_root + "/" )
281:
282: return nil unless rootRe.match( path )
283: subpath = path.
284: sub( rootRe, '' ).
285: split( %r{/} ).
286: first
287:
288: return subpath
289: end
Set the necessary header to make the displayed page refresh to the specified url in the given number of seconds.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 494
494: def refresh( seconds, url=nil )
495: seconds = Integer( seconds )
496: url ||= self.construct_url( '' )
497: if !URI.parse( url ).absolute?
498: url = self.construct_url( url )
499: end
500:
501: self.headers_out['Refresh'] = "%d;%s" % [seconds, url]
502: end
Fetch the client‘s IP, either from proxy headers or the connection‘s IP.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 364
364: def remote_ip
365: return self.headers_in['X-Forwarded-For'] || self.connection.remote_ip
366: end
Return the Content-type header given in the request‘s headers, if any
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 397
397: def request_content_type
398: return self.headers_in['Content-type']
399: end
Returns true if the dispatcher is mounted on the root URI ("/")
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 225
225: def root_dispatcher?
226: return @root_dispatcher
227: end
The session associated with the receiver (an Arrow::Session object).
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 176
176: def session( config={} )
177: @session ||= Arrow::Session.create( self, config )
178: end
Returns true if a session has been created for the receiver.
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 170
170: def session?
171: @session ? true : false
172: end
Return a minimal HTML doc for representing a given status_code
# File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 454
454: def status_doc( status_code, uri=nil )
455: body = ''
456: if uri
457: body = %q{<a href="%s">%s</a>} % [ uri, uri ]
458: end
459:
460: #<head><title>%d %s</title></head>
461: #<body><h1>%s</h1><p>%s</p></body>
462: return HTMLDoc % [
463: status_code,
464: StatusName[status_code],
465: StatusName[status_code],
466: body
467: ]
468: end
--- SEC00184
--- ""
---
- name: applet_path
rw: RW
a_desc: |+
The <a href="Transaction.html#M000213">applet</a> portion of the path_info
- name: broker
rw: R
a_desc: |+
The <a href="Broker.html">Arrow::Broker</a> that is responsible for
delegating the <a href="Transaction.html">Transaction</a> to one or more <a
href="Applet.html">Arrow::Applet</a> objects.
- name: config
rw: R
a_desc: |+
The <a href="Config.html">Arrow::Config</a> object for the <a
href="../Arrow.html">Arrow</a> application that created this transaction.
- name: cookies
rw: R
a_desc: |+
The <a href="CookieSet.html">Arrow::CookieSet</a> that contains cookies to
be added to the response
- name: data
rw: R
a_desc: |+
User-data hash. Can be used to pass data between applets in a chain.
- name: handler_status
rw: RW
a_desc: |+
The handler status code to return to Apache
- name: request
rw: R
a_desc: |+
The <a href="../Apache/Request.html">Apache::Request</a> that initiated
this transaction
- name: request_cookies
rw: R
a_desc: |+
The Hash of Arrow::Cookies parsed from the request
- name: serial
rw: R
a_desc: |+
The transaction‘s unique id in the context of the system.
- name: vargs
rw: RW
a_desc: |+
The argument validator (a <a href="FormValidator.html">FormValidator</a>
object)
---
- methods:
- visibility: public
aref: M000201
name: new
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 86</span>\n 86: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">request</span>, <span class=\"ruby-identifier\">config</span>, <span class=\"ruby-identifier\">broker</span> )\n 87: <span class=\"ruby-ivar\">@request</span> = <span class=\"ruby-identifier\">request</span>\n 88: <span class=\"ruby-ivar\">@config</span> = <span class=\"ruby-identifier\">config</span>\n 89: <span class=\"ruby-ivar\">@broker</span> = <span class=\"ruby-identifier\">broker</span>\n 90: <span class=\"ruby-ivar\">@handler_status</span> = <span class=\"ruby-constant\">Apache</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">OK</span>\n 91: \n 92: <span class=\"ruby-ivar\">@serial</span> = <span class=\"ruby-identifier\">make_transaction_serial</span>( <span class=\"ruby-identifier\">request</span> )\n 93: \n 94: <span class=\"ruby-comment cmt\"># Stuff that may be filled in later</span>\n 95: <span class=\"ruby-ivar\">@session</span> = <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-comment cmt\"># Lazily-instantiated</span>\n 96: <span class=\"ruby-ivar\">@applet_path</span> = <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-comment cmt\"># Added by the broker</span>\n 97: <span class=\"ruby-ivar\">@vargs</span> = <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-comment cmt\"># Filled in by the applet</span>\n 98: <span class=\"ruby-ivar\">@data</span> = {}\n 99: <span class=\"ruby-ivar\">@request_cookies</span> = <span class=\"ruby-identifier\">parse_cookies</span>( <span class=\"ruby-identifier\">request</span> )\n\
100: <span class=\"ruby-ivar\">@cookies</span> = <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">CookieSet</span>.<span class=\"ruby-identifier\">new</span>()\n\
101: \n\
102: <span class=\"ruby-comment cmt\"># Check for a "RubyOption root_dispatcher true"</span>\n\
103: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@request</span>.<span class=\"ruby-identifier\">options</span>.<span class=\"ruby-identifier\">key?</span>(<span class=\"ruby-value str\">'root_dispatcher'</span>) <span class=\"ruby-operator\">&&</span>\n\
104: <span class=\"ruby-ivar\">@request</span>.<span class=\"ruby-identifier\">options</span>[<span class=\"ruby-value str\">'root_dispatcher'</span>].<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-regexp re\">/^(true|yes|1)$/i</span> )\n\
105: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">"Dispatching from root path"</span>\n\
106: <span class=\"ruby-ivar\">@root_dispatcher</span> = <span class=\"ruby-keyword kw\">true</span>\n\
107: <span class=\"ruby-keyword kw\">else</span>\n\
108: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">"Dispatching from sub-path"</span>\n\
109: <span class=\"ruby-ivar\">@root_dispatcher</span> = <span class=\"ruby-keyword kw\">false</span>\n\
110: <span class=\"ruby-keyword kw\">end</span>\n\
111: \n\
112: <span class=\"ruby-keyword kw\">super</span>()\n\
113: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Create a <a href="Transaction.html#M000201">new</a> <a
href="Transaction.html">Arrow::Transaction</a> object with the specified
<tt>request</tt> (an <a href="../Apache/Request.html">Apache::Request</a>
object), <tt>config</tt> (an <a href="Config.html">Arrow::Config</a>
object), <tt>broker</tt> object (an <a
href="Broker.html">Arrow::Broker</a>), and <tt><a
href="Transaction.html#M000204">session</a></tt> (<a
href="Session.html">Arrow::Session</a>) objects.
</p>
params: ( request, config, broker )
category: Class
type: Public
- methods:
- visibility: public
aref: M000218
name: add_cookie_headers
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 319</span>\n\
319: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">add_cookie_headers</span>\n\
320: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">cookies</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">cookie</span><span class=\"ruby-operator\">|</span>\n\
321: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">is_success?</span>\n\
322: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">"Adding 'Set-Cookie' header: %p (%p)"</span> <span class=\"ruby-operator\">%</span> \n\
323: [<span class=\"ruby-identifier\">cookie</span>, <span class=\"ruby-identifier\">cookie</span>.<span class=\"ruby-identifier\">to_s</span>]\n\
324: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_out</span>[<span class=\"ruby-value str\">'Set-Cookie'</span>] = <span class=\"ruby-identifier\">cookie</span>.<span class=\"ruby-identifier\">to_s</span>\n\
325: <span class=\"ruby-keyword kw\">else</span>\n\
326: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">"Adding 'Set-Cookie' to the error headers: %p (%p)"</span> <span class=\"ruby-operator\">%</span>\n\
327: [<span class=\"ruby-identifier\">cookie</span>, <span class=\"ruby-identifier\">cookie</span>.<span class=\"ruby-identifier\">to_s</span>]\n\
328: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">err_headers_out</span>[<span class=\"ruby-value str\">'Set-Cookie'</span>] = <span class=\"ruby-identifier\">cookie</span>.<span class=\"ruby-identifier\">to_s</span>\n\
329: <span class=\"ruby-keyword kw\">end</span>\n\
330: <span class=\"ruby-keyword kw\">end</span>\n\
331: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Add a ‘Set-<a href="Cookie.html">Cookie</a>’ header to the
response for each cookie that currently exists the transaction‘s
cookieset.
</p>
params: ()
- visibility: public
aref: M000209
name: app_root
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 242</span>\n\
242: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">app_root</span>\n\
243: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-value str\">""</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">root_dispatcher?</span>\n\
244: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-ivar\">@request</span>.<span class=\"ruby-identifier\">script_name</span>\n\
245: <span class=\"ruby-keyword kw\">end</span>"
aka:
- aref: Transaction.html#M000210
name: approot
m_desc: |-
<p>
Return the portion of the request‘s URI that serves as the base URI
for the application. All self-referential URLs created by the application
should include this.
</p>
params: ()
- visibility: public
aref: M000211
name: app_root_url
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 251</span>\n\
251: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">app_root_url</span>\n\
252: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">construct_url</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">app_root</span> )\n\
253: <span class=\"ruby-keyword kw\">end</span>"
aka:
- aref: Transaction.html#M000212
name: approot_url
m_desc: |-
<p>
Returns a fully-qualified URI String to the current <a
href="Transaction.html#M000213">applet</a> using the request object‘s
server name and port.
</p>
params: ()
- visibility: public
aref: M000213
name: applet
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 259</span>\n\
259: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">applet</span>\n\
260: <span class=\"ruby-keyword kw\">return</span> [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">app_root</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">applet_path</span> ].<span class=\"ruby-identifier\">join</span>(<span class=\"ruby-value str\">"/"</span>).<span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">%r{//+}</span>, <span class=\"ruby-value str\">'/'</span> )\n\
261: <span class=\"ruby-keyword kw\">end</span>"
aka:
- aref: Transaction.html#M000214
name: applet_uri
m_desc: |-
<p>
Return an absolute uri that refers back to the <a
href="Transaction.html#M000213">applet</a> the transaction is being run in
</p>
params: ()
- visibility: public
aref: M000214
name: applet_uri
m_desc: |-
<p>
Alias for <a href="Transaction.html#M000213">#applet</a>
</p>
params: ()
- visibility: public
aref: M000215
name: applet_url
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 268</span>\n\
268: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">applet_url</span>\n\
269: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">construct_url</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">applet</span> )\n\
270: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns a fully-qualified URI String to the current <a
href="Transaction.html#M000213">applet</a> using the request object‘s
server name and port.
</p>
params: ()
- visibility: public
aref: M000210
name: approot
m_desc: |-
<p>
Alias for <a href="Transaction.html#M000209">#app_root</a>
</p>
params: ()
- visibility: public
aref: M000212
name: approot_url
m_desc: |-
<p>
Alias for <a href="Transaction.html#M000211">#app_root_url</a>
</p>
params: ()
- visibility: public
aref: M000234
name: arrow_version
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 506</span>\n\
506: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">arrow_version</span>\n\
507: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">VERSION</span>\n\
508: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Get the verson of <a href="../Arrow.html">Arrow</a> currently running.
</p>
params: ()
- visibility: public
aref: M000223
name: attachment=
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 378</span>\n\
378: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">attachment=</span>( <span class=\"ruby-identifier\">filename</span> )\n\
379: \n\
380: <span class=\"ruby-comment cmt\"># IE flubs attachments of any mimetype it handles directly.</span>\n\
381: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">browser_is_ie?</span>\n\
382: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">content_type</span> = <span class=\"ruby-value str\">'application/octet-stream'</span>\n\
383: <span class=\"ruby-keyword kw\">end</span>\n\
384: \n\
385: <span class=\"ruby-identifier\">val</span> = <span class=\"ruby-value str\">%q{attachment; filename="%s"}</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-identifier\">filename</span> ]\n\
386: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_out</span>[<span class=\"ruby-value str\">'Content-Disposition'</span>] = <span class=\"ruby-identifier\">val</span>\n\
387: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Set the result‘s ‘Content-Disposition’ header to
‘attachment’ and set the attachment‘s <tt>filename</tt>.
</p>
params: ( filename )
- visibility: public
aref: M000226
name: browser_is_ie?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 406</span>\n\
406: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">browser_is_ie?</span>\n\
407: <span class=\"ruby-identifier\">agent</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_in</span>[<span class=\"ruby-value str\">'user-agent'</span>] <span class=\"ruby-operator\">||</span> <span class=\"ruby-value str\">''</span>\n\
408: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">agent</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-regexp re\">/MSIE/</span> <span class=\"ruby-operator\">?</span> <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-keyword kw\">false</span>\n\
409: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns true if the User-Agent header indicates that the remote browser is
Internet Explorer. Useful for making the inevitable IE workarounds.
</p>
params: ()
- visibility: public
aref: M000219
name: construct_url
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 338</span>\n\
338: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">construct_url</span>( <span class=\"ruby-identifier\">uri</span> )\n\
339: <span class=\"ruby-identifier\">url</span> = <span class=\"ruby-ivar\">@request</span>.<span class=\"ruby-identifier\">construct_url</span>( <span class=\"ruby-identifier\">uri</span> )\n\
340: \n\
341: <span class=\"ruby-comment cmt\"># If the request came through a proxy, rewrite the url's host to match</span>\n\
342: <span class=\"ruby-comment cmt\"># the hostname the proxy is forwarding for.</span>\n\
343: <span class=\"ruby-keyword kw\">if</span> (( <span class=\"ruby-identifier\">host</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">proxied_host</span> ))\n\
344: <span class=\"ruby-identifier\">uriobj</span> = <span class=\"ruby-constant\">URI</span>.<span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-identifier\">url</span> )\n\
345: <span class=\"ruby-identifier\">uriobj</span>.<span class=\"ruby-identifier\">host</span> = <span class=\"ruby-identifier\">host</span>\n\
346: <span class=\"ruby-identifier\">url</span> = <span class=\"ruby-identifier\">uriobj</span>.<span class=\"ruby-identifier\">to_s</span>\n\
347: <span class=\"ruby-keyword kw\">end</span>\n\
348: \n\
349: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">url</span>\n\
350: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Overridden from <a href="../Apache/Request.html">Apache::Request</a> to
take Apache mod_proxy headers into account. If the
‘X-Forwarded-Host’ or ‘X-Forwarded-Server’ headers
exist in the request, the hostname specified is used instead of the
canonical host.
</p>
params: ( uri )
- visibility: public
aref: M000227
name: for_ie_users
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 415</span>\n\
415: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">for_ie_users</span>\n\
416: <span class=\"ruby-keyword kw\">yield</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">browser_is_ie?</span>\n\
417: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Execute a block if the User-Agent header indicates that the remote browser
is Internet Explorer. Useful for making the inevitable IE workarounds.
</p>
params: () {|if self.browser_is_ie?| ...}
- visibility: public
aref: M000229
name: form_request?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 434</span>\n\
434: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">form_request?</span>\n\
435: <span class=\"ruby-keyword kw\">case</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">request_method</span>\n\
436: <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-value str\">'GET'</span>, <span class=\"ruby-value str\">'HEAD'</span>, <span class=\"ruby-value str\">'DELETE'</span>, <span class=\"ruby-value str\">'PUT'</span>\n\
437: <span class=\"ruby-keyword kw\">return</span> (<span class=\"ruby-operator\">!</span><span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">parsed_uri</span>.<span class=\"ruby-identifier\">query</span>.<span class=\"ruby-identifier\">nil?</span> <span class=\"ruby-operator\">||</span> \n\
438: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">request_content_type</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-constant\">FORM_CONTENT_TYPES</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-keyword kw\">false</span>\n\
439: \n\
440: <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-value str\">'POST'</span>\n\
441: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">request_content_type</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-constant\">FORM_CONTENT_TYPES</span> <span class=\"ruby-value\">? </span><span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-keyword kw\">false</span>\n\
442: \n\
443: <span class=\"ruby-keyword kw\">else</span>\n\
444: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">false</span>\n\
445: <span class=\"ruby-keyword kw\">end</span>\n\
446: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Return <tt>true</tt> if there are HTML form parameters in the request,
either in the query string with a GET request, or in the body of a POST
with a mimetype of either ‘application/x-www-form-urlencoded’
or ‘multipart/form-data’.
</p>
params: ()
- visibility: public
aref: M000202
name: inspect
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 159</span>\n\
159: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
160: <span class=\"ruby-value str\">"#<%s:0x%0x serial: %s; HTTP status: %d>"</span> <span class=\"ruby-operator\">%</span> [\n\
161: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>,\n\
162: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">object_id</span> <span class=\"ruby-operator\">*</span> <span class=\"ruby-value\">2</span>,\n\
163: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">serial</span>,\n\
164: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">status</span>\n\
165: ]\n\
166: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns a human-readable String representation of the transaction, suitable
for debugging.
</p>
params: ()
- visibility: public
aref: M000228
name: is_ajax_request?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 422</span>\n\
422: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">is_ajax_request?</span>\n\
423: <span class=\"ruby-identifier\">xrw_header</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_in</span>[<span class=\"ruby-value str\">'x-requested-with'</span>]\n\
424: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-operator\">!</span><span class=\"ruby-identifier\">xrw_header</span>.<span class=\"ruby-identifier\">nil?</span> <span class=\"ruby-operator\">&&</span> <span class=\"ruby-identifier\">xrw_header</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-regexp re\">/xmlhttprequest/i</span>\n\
425: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">false</span>\n\
426: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Return <tt>true</tt> if the request is from XMLHttpRequest (as indicated by
the ‘X-Requested-With’ header from Scriptaculous or jQuery)
</p>
params: ()
- visibility: public
aref: M000206
name: is_declined?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 190</span>\n\
190: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">is_declined?</span>\n\
191: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">"Checking to see if the transaction is declined (%p)"</span> <span class=\"ruby-operator\">%</span>\n\
192: [<span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">handler_status</span>]\n\
193: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">handler_status</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-constant\">Apache</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">DECLINED</span> <span class=\"ruby-value\">? </span><span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-keyword kw\">false</span>\n\
194: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns true if the transaction‘s server status will cause the
request to be declined (i.e., not handled by <a
href="../Arrow.html">Arrow</a>)
</p>
params: ()
- visibility: public
aref: M000205
name: is_success?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 182</span>\n\
182: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">is_success?</span>\n\
183: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">status</span>\n\
184: <span class=\"ruby-keyword kw\">return</span> (<span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">status</span> <span class=\"ruby-operator\">/</span> <span class=\"ruby-value\">100</span>) <span class=\"ruby-operator\">==</span> <span class=\"ruby-value\">2</span>\n\
185: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns true if the transactions response status is 2xx.
</p>
params: ()
- visibility: public
aref: M000232
name: not_modified
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 487</span>\n\
487: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">not_modified</span>\n\
488: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">redirect</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-constant\">Apache</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">HTTP_NOT_MODIFIED</span> )\n\
489: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Set the necessary header fields in the response to cause a NOT_MODIFIED
response to be sent.
</p>
params: ()
- visibility: public
aref: M000224
name: parsed_uri
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 391</span>\n\
391: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">parsed_uri</span>\n\
392: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">URI</span>.<span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">request</span>.<span class=\"ruby-identifier\">unparsed_uri</span> )\n\
393: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Return a URI object that is parsed from the request‘s URI.
</p>
params: ()
- visibility: public
aref: M000208
name: path
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 232</span>\n\
232: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">path</span>\n\
233: <span class=\"ruby-identifier\">path</span> = <span class=\"ruby-ivar\">@request</span>.<span class=\"ruby-identifier\">uri</span>\n\
234: <span class=\"ruby-identifier\">uripat</span> = <span class=\"ruby-constant\">Regexp</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-value str\">"^"</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">app_root</span> )\n\
235: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">path</span>.<span class=\"ruby-identifier\">sub</span>( <span class=\"ruby-identifier\">uripat</span>, <span class=\"ruby-value str\">''</span> )\n\
236: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns the <a href="Transaction.html#M000208">path</a> operated on by the
<a href="Broker.html">Arrow::Broker</a> when delegating the transaction.
Equal to the #uri minus the <a
href="Transaction.html#M000209">#app_root</a>.
</p>
params: ()
- visibility: public
aref: M000220
name: proxied_host
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 357</span>\n\
357: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">proxied_host</span>\n\
358: <span class=\"ruby-identifier\">headers</span> = <span class=\"ruby-ivar\">@request</span>.<span class=\"ruby-identifier\">headers_in</span>\n\
359: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">headers</span>[<span class=\"ruby-value str\">'x-forwarded-host'</span>] <span class=\"ruby-operator\">||</span> <span class=\"ruby-identifier\">headers</span>[<span class=\"ruby-value str\">'x-forwarded-server'</span>]\n\
360: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
If the request came from a reverse proxy (i.e., the X-Forwarded-Host or
X-Forwarded-Server headers are present), return the hostname that the proxy
is forwarding for. If no proxy headers are present, return nil.
</p>
params: ()
- visibility: public
aref: M000231
name: redirect
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 475</span>\n\
475: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">redirect</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">status_code</span>=<span class=\"ruby-constant\">Apache</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">HTTP_MOVED_TEMPORARILY</span> )\n\
476: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">"Redirecting to %s"</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">uri</span>\n\
477: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_out</span>[ <span class=\"ruby-value str\">'Location'</span> ] = <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">to_s</span>\n\
478: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">status</span> = <span class=\"ruby-identifier\">status_code</span>\n\
479: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">handler_status</span> = <span class=\"ruby-constant\">Apache</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">REDIRECT</span>\n\
480: \n\
481: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-value str\">''</span>\n\
482: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Set the necessary fields in the request to cause the response to be a <a
href="Transaction.html#M000231">redirect</a> to the given <tt>url</tt> with
the specified <tt>status_code</tt> (302 by default).
</p>
params: ( uri, status_code=Apache::HTTP_MOVED_TEMPORARILY )
- visibility: public
aref: M000222
name: referer
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 371</span>\n\
371: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">referer</span>\n\
372: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_in</span>[<span class=\"ruby-value str\">'Referer'</span>]\n\
373: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Get the request‘s <a href="Transaction.html#M000222">referer</a>, if
any
</p>
params: ()
- visibility: public
aref: M000217
name: referring_action
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 296</span>\n\
296: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">referring_action</span>\n\
297: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">referer</span>\n\
298: <span class=\"ruby-identifier\">uri</span> = <span class=\"ruby-constant\">URI</span>.<span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">referer</span> )\n\
299: <span class=\"ruby-identifier\">path</span> = <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">path</span> <span class=\"ruby-keyword kw\">or</span> <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span>\n\
300: <span class=\"ruby-identifier\">appletRe</span> = <span class=\"ruby-constant\">Regexp</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">app_root</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-value str\">"/\\\\w+/"</span> )\n\
301: \n\
302: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">appletRe</span>.<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-identifier\">path</span> )\n\
303: <span class=\"ruby-identifier\">subpath</span> = <span class=\"ruby-identifier\">path</span>.\n\
304: <span class=\"ruby-identifier\">sub</span>( <span class=\"ruby-identifier\">appletRe</span>, <span class=\"ruby-value str\">''</span> ).\n\
305: <span class=\"ruby-identifier\">split</span>( <span class=\"ruby-regexp re\">%r{/}</span> ).\n\
306: <span class=\"ruby-identifier\">first</span>\n\
307: \n\
308: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">subpath</span>\n\
309: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
If the <a href="Transaction.html#M000222">referer</a> was another <a
href="Transaction.html#M000213">applet</a> under the same <a
href="../Arrow.html">Arrow</a> instance, return the name of the action that
preceded the current one. If there was no ‘Referer’ header, or
the <a href="Transaction.html#M000222">referer</a> wasn‘t an <a
href="Transaction.html#M000213">applet</a> under the same <a
href="../Arrow.html">Arrow</a> instance, return <tt>nil</tt>.
</p>
params: ()
- visibility: public
aref: M000216
name: referring_applet
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 276</span>\n\
276: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">referring_applet</span>\n\
277: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">referer</span>\n\
278: <span class=\"ruby-identifier\">uri</span> = <span class=\"ruby-constant\">URI</span>.<span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">referer</span> )\n\
279: <span class=\"ruby-identifier\">path</span> = <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">path</span> <span class=\"ruby-keyword kw\">or</span> <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span>\n\
280: <span class=\"ruby-identifier\">rootRe</span> = <span class=\"ruby-constant\">Regexp</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">app_root</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-value str\">"/"</span> )\n\
281: \n\
282: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">rootRe</span>.<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-identifier\">path</span> )\n\
283: <span class=\"ruby-identifier\">subpath</span> = <span class=\"ruby-identifier\">path</span>.\n\
284: <span class=\"ruby-identifier\">sub</span>( <span class=\"ruby-identifier\">rootRe</span>, <span class=\"ruby-value str\">''</span> ).\n\
285: <span class=\"ruby-identifier\">split</span>( <span class=\"ruby-regexp re\">%r{/}</span> ).\n\
286: <span class=\"ruby-identifier\">first</span>\n\
287: \n\
288: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">subpath</span>\n\
289: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
If the <a href="Transaction.html#M000222">referer</a> was another <a
href="Transaction.html#M000213">applet</a> under the same <a
href="../Arrow.html">Arrow</a> instance, return the uri to it. If there was
no ‘Referer’ header, or the <a
href="Transaction.html#M000222">referer</a> wasn‘t an <a
href="Transaction.html#M000213">applet</a> under the same <a
href="../Arrow.html">Arrow</a> instance, returns <tt>nil</tt>.
</p>
params: ()
- visibility: public
aref: M000233
name: refresh
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 494</span>\n\
494: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">refresh</span>( <span class=\"ruby-identifier\">seconds</span>, <span class=\"ruby-identifier\">url</span>=<span class=\"ruby-keyword kw\">nil</span> )\n\
495: <span class=\"ruby-identifier\">seconds</span> = <span class=\"ruby-constant\">Integer</span>( <span class=\"ruby-identifier\">seconds</span> )\n\
496: <span class=\"ruby-identifier\">url</span> <span class=\"ruby-operator\">||=</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">construct_url</span>( <span class=\"ruby-value str\">''</span> )\n\
497: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-operator\">!</span><span class=\"ruby-constant\">URI</span>.<span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-identifier\">url</span> ).<span class=\"ruby-identifier\">absolute?</span>\n\
498: <span class=\"ruby-identifier\">url</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">construct_url</span>( <span class=\"ruby-identifier\">url</span> )\n\
499: <span class=\"ruby-keyword kw\">end</span>\n\
500: \n\
501: <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_out</span>[<span class=\"ruby-value str\">'Refresh'</span>] = <span class=\"ruby-value str\">"%d;%s"</span> <span class=\"ruby-operator\">%</span> [<span class=\"ruby-identifier\">seconds</span>, <span class=\"ruby-identifier\">url</span>]\n\
502: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Set the necessary header to make the displayed page <a
href="Transaction.html#M000233">refresh</a> to the specified <tt>url</tt>
in the given number of <tt>seconds</tt>.
</p>
params: ( seconds, url=nil )
- visibility: public
aref: M000221
name: remote_ip
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 364</span>\n\
364: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">remote_ip</span>\n\
365: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_in</span>[<span class=\"ruby-value str\">'X-Forwarded-For'</span>] <span class=\"ruby-operator\">||</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">connection</span>.<span class=\"ruby-identifier\">remote_ip</span>\n\
366: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Fetch the client‘s IP, either from proxy headers or the
connection‘s IP.
</p>
params: ()
- visibility: public
aref: M000225
name: request_content_type
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 397</span>\n\
397: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">request_content_type</span>\n\
398: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">headers_in</span>[<span class=\"ruby-value str\">'Content-type'</span>]\n\
399: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Return the Content-type header given in the request‘s headers, if any
</p>
params: ()
- visibility: public
aref: M000207
name: root_dispatcher?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 225</span>\n\
225: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">root_dispatcher?</span>\n\
226: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-ivar\">@root_dispatcher</span>\n\
227: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns <tt>true</tt> if the dispatcher is mounted on the root URI
("/")
</p>
params: ()
- visibility: public
aref: M000204
name: session
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 176</span>\n\
176: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">session</span>( <span class=\"ruby-identifier\">config</span>={} )\n\
177: <span class=\"ruby-ivar\">@session</span> <span class=\"ruby-operator\">||=</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Session</span>.<span class=\"ruby-identifier\">create</span>( <span class=\"ruby-keyword kw\">self</span>, <span class=\"ruby-identifier\">config</span> )\n\
178: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
The <a href="Transaction.html#M000204">session</a> associated with the
receiver (an <a href="Session.html">Arrow::Session</a> object).
</p>
params: ( config={} )
- visibility: public
aref: M000203
name: session?
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 170</span>\n\
170: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">session?</span>\n\
171: <span class=\"ruby-ivar\">@session</span> <span class=\"ruby-operator\">?</span> <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-keyword kw\">false</span>\n\
172: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Returns <tt>true</tt> if a <a href="Transaction.html#M000204">session</a>
has been created for the receiver.
</p>
params: ()
- visibility: public
aref: M000230
name: status_doc
sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/transaction.rb, line 454</span>\n\
454: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">status_doc</span>( <span class=\"ruby-identifier\">status_code</span>, <span class=\"ruby-identifier\">uri</span>=<span class=\"ruby-keyword kw\">nil</span> )\n\
455: <span class=\"ruby-identifier\">body</span> = <span class=\"ruby-value str\">''</span>\n\
456: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">uri</span>\n\
457: <span class=\"ruby-identifier\">body</span> = <span class=\"ruby-value str\">%q{<a href="%s">%s</a>}</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">uri</span> ]\n\
458: <span class=\"ruby-keyword kw\">end</span>\n\
459: \n\
460: <span class=\"ruby-comment cmt\">#<head><title>%d %s</title></head></span>\n\
461: <span class=\"ruby-comment cmt\">#<body><h1>%s</h1><p>%s</p></body></span>\n\
462: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">HTMLDoc</span> <span class=\"ruby-operator\">%</span> [\n\
463: <span class=\"ruby-identifier\">status_code</span>,\n\
464: <span class=\"ruby-constant\">StatusName</span>[<span class=\"ruby-identifier\">status_code</span>],\n\
465: <span class=\"ruby-constant\">StatusName</span>[<span class=\"ruby-identifier\">status_code</span>],\n\
466: <span class=\"ruby-identifier\">body</span>\n\
467: ]\n\
468: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<p>
Return a minimal HTML doc for representing a given status_code
</p>
params: ( status_code, uri=nil )
category: Instance
type: Public
---
---
- name: SVNRev
desc: |+
SVN Revision
value: "%q$Rev: 437 $"
- name: SVNId
desc: |+
SVN Id
value: "%q$Id: transaction.rb 437 2008-03-28 00:49:20Z deveiant $"
- name: HTMLDoc
value: "<<-"EOF".gsub(/^\\t/, '') <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html> <head><title>%d %s</title></head> <body><h1>%s</h1><p>%s</p></body> </html> EOF .gsub(/^\\t/, '')"
- name: StatusName
desc: |+
Status names
value: "{ 300 => "Multiple Choices", 301 => "Moved Permanently", 302 => "Found", 303 => "See Other", 304 => "Not Modified", 305 => "Use Proxy", 307 => "Temporary Redirect", }"
- name: DelegatedMethods
value: Apache::Request.instance_methods(false) - [ "inspect", "to_s"
- name: FORM_CONTENT_TYPES
value: "%r{application/x-www-form-urlencoded|multipart/form-data}i"
Generated with the Darkfish Rdoc Generator.