D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby18
/
lib64
/
ruby
/
gems
/
1.8
/
doc
/
rack-1.6.1
/
rdoc
/
classes
/
Rack
/
Filename :
Response.html
back
Copy
<?xml version="1.0" encoding="iso-8859-1"?> <!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>Class: Rack::Response</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <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="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">Rack::Response</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../files/lib/rack/response_rb.html"> lib/rack/response.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> <a href="Response.html">Rack::Response</a> provides a convenient interface to create a <a href="../Rack.html">Rack</a> response. </p> <p> It allows setting of headers and cookies, and provides useful defaults (a OK response containing HTML). </p> <p> You can use <a href="Response.html#M000219">Response#write</a> to iteratively generate your response, but note that this is buffered by <a href="Response.html">Rack::Response</a> until you call <tt><a href="Response.html#M000215">finish</a></tt>. <tt><a href="Response.html#M000215">finish</a></tt> however can take a block inside which calls to <tt><a href="Response.html#M000219">write</a></tt> are synchronous with the <a href="../Rack.html">Rack</a> response. </p> <p> Your application‘s <tt>call</tt> should end returning <a href="Response.html#M000215">Response#finish</a>. </p> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000210">[]</a> <a href="#M000211">[]=</a> <a href="#M000220">close</a> <a href="#M000213">delete_cookie</a> <a href="#M000218">each</a> <a href="#M000221">empty?</a> <a href="#M000215">finish</a> <a href="#M000209">new</a> <a href="#M000214">redirect</a> <a href="#M000212">set_cookie</a> <a href="#M000216">to_a</a> <a href="#M000217">to_ary</a> <a href="#M000219">write</a> </div> </div> </div> <!-- if includes --> <div id="includes"> <h3 class="section-bar">Included Modules</h3> <div id="includes-list"> <span class="include-name"><a href="Response/Helpers.html">Helpers</a></span> </div> </div> <div id="section"> <div id="class-list"> <h3 class="section-bar">Classes and Modules</h3> Module <a href="Response/Helpers.html" class="link">Rack::Response::Helpers</a><br /> </div> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">CHUNKED</td> <td>=</td> <td class="context-item-value">'chunked'.freeze</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">TRANSFER_ENCODING</td> <td>=</td> <td class="context-item-value">'Transfer-Encoding'.freeze</td> </tr> </table> </div> </div> <div id="aliases-list"> <h3 class="section-bar">External Aliases</h3> <div class="name-list"> <table summary="aliases"> <tr class="top-aligned-row context-row"> <td class="context-item-name">header</td> <td>-></td> <td class="context-item-value">headers</td> </tr> </table> </div> </div> <div id="attribute-list"> <h3 class="section-bar">Attributes</h3> <div class="name-list"> <table> <tr class="top-aligned-row context-row"> <td class="context-item-name">body</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">header</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">length</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">status</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000209" class="method-detail"> <a name="M000209"></a> <div class="method-heading"> <a href="Response.src/M000209.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000209.html');return false;"> <span class="method-name">new</span><span class="method-args">(body=[], status=200, header={}) {|self if block_given?| ...}</span> </a> </div> <div class="method-description"> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000210" class="method-detail"> <a name="M000210"></a> <div class="method-heading"> <a href="Response.src/M000210.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000210.html');return false;"> <span class="method-name">[]</span><span class="method-args">(key)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000211" class="method-detail"> <a name="M000211"></a> <div class="method-heading"> <a href="Response.src/M000211.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000211.html');return false;"> <span class="method-name">[]=</span><span class="method-args">(key, value)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000220" class="method-detail"> <a name="M000220"></a> <div class="method-heading"> <a href="Response.src/M000220.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000220.html');return false;"> <span class="method-name">close</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000213" class="method-detail"> <a name="M000213"></a> <div class="method-heading"> <a href="Response.src/M000213.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000213.html');return false;"> <span class="method-name">delete_cookie</span><span class="method-args">(key, value={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000218" class="method-detail"> <a name="M000218"></a> <div class="method-heading"> <a href="Response.src/M000218.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000218.html');return false;"> <span class="method-name">each</span><span class="method-args">(&callback)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000221" class="method-detail"> <a name="M000221"></a> <div class="method-heading"> <a href="Response.src/M000221.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000221.html');return false;"> <span class="method-name">empty?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000215" class="method-detail"> <a name="M000215"></a> <div class="method-heading"> <a href="Response.src/M000215.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000215.html');return false;"> <span class="method-name">finish</span><span class="method-args">(&block)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000214" class="method-detail"> <a name="M000214"></a> <div class="method-heading"> <a href="Response.src/M000214.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000214.html');return false;"> <span class="method-name">redirect</span><span class="method-args">(target, status=302)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000212" class="method-detail"> <a name="M000212"></a> <div class="method-heading"> <a href="Response.src/M000212.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000212.html');return false;"> <span class="method-name">set_cookie</span><span class="method-args">(key, value)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000216" class="method-detail"> <a name="M000216"></a> <div class="method-heading"> <span class="method-name">to_a</span><span class="method-args">(&block)</span> </div> <div class="method-description"> <p> Alias for <a href="Response.html#M000215">finish</a> </p> </div> </div> <div id="method-M000217" class="method-detail"> <a name="M000217"></a> <div class="method-heading"> <span class="method-name">to_ary</span><span class="method-args">(&block)</span> </div> <div class="method-description"> <p> Alias for <a href="Response.html#M000215">finish</a> </p> </div> </div> <div id="method-M000219" class="method-detail"> <a name="M000219"></a> <div class="method-heading"> <a href="Response.src/M000219.html" target="Code" class="method-signature" onclick="popupCode('Response.src/M000219.html');return false;"> <span class="method-name">write</span><span class="method-args">(str)</span> </a> </div> <div class="method-description"> <p> Append to body and update Content-Length. </p> <p> NOTE: Do not mix <a href="Response.html#M000219">write</a> and direct body access! </p> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>