Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 8b99df826c3b6cf56a1caaae5f931d50 > files > 531

ruby-actionpack-2.3.4-1mdv2010.0.noarch.rpm

<?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: ActionController::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">ActionController::Response</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/action_controller/response_rb.html">
                lib/action_controller/response.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Rack::Response
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Represents an HTTP response generated by a controller action. One can use
an <a href="Response.html">ActionController::Response</a> object to
retrieve the current state of the response, or customize the response. An
<a href="Response.html">Response</a> object can either represent a
&quot;real&quot; HTTP response (i.e. one that is meant to be sent back to
the web browser) or a test response (i.e. one that is generated from
integration tests). See CgiResponse and <a
href="TestResponse.html">TestResponse</a>, respectively.
</p>
<p>
<a href="Response.html">Response</a> is mostly a Ruby on Rails framework
implement detail, and should never be used directly in controllers.
Controllers should use the methods defined in <a
href="Base.html">ActionController::Base</a> instead. For example, if you
want to set the HTTP response&#8216;s content MIME type, then use
ActionControllerBase#headers instead of Response#headers.
</p>
<p>
Nevertheless, integration tests may want to inspect controller responses in
more detail, and that&#8216;s when <a href="Response.html">Response</a> can
be useful for application developers. Integration test methods such as
ActionController::Integration::Session#get and
ActionController::Integration::Session#post return objects of type <a
href="TestResponse.html">TestResponse</a> (which are of course also of type
<a href="Response.html">Response</a>).
</p>
<p>
For example, the following demo integration &quot;test&quot; prints the
body of the controller response to the console:
</p>
<pre>
 class DemoControllerTest &lt; ActionController::IntegrationTest
   def test_print_root_path_to_console
     get('/')
     puts @response.body
   end
 end
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000277">assign_default_content_type_and_charset!</a>&nbsp;&nbsp;
      <a href="#M000268">charset</a>&nbsp;&nbsp;
      <a href="#M000267">charset=</a>&nbsp;&nbsp;
      <a href="#M000266">content_type</a>&nbsp;&nbsp;
      <a href="#M000265">content_type=</a>&nbsp;&nbsp;
      <a href="#M000279">each</a>&nbsp;&nbsp;
      <a href="#M000272">etag</a>&nbsp;&nbsp;
      <a href="#M000274">etag=</a>&nbsp;&nbsp;
      <a href="#M000273">etag?</a>&nbsp;&nbsp;
      <a href="#M000269">last_modified</a>&nbsp;&nbsp;
      <a href="#M000271">last_modified=</a>&nbsp;&nbsp;
      <a href="#M000270">last_modified?</a>&nbsp;&nbsp;
      <a href="#M000263">location</a>&nbsp;&nbsp;
      <a href="#M000264">location=</a>&nbsp;&nbsp;
      <a href="#M000262">new</a>&nbsp;&nbsp;
      <a href="#M000278">prepare!</a>&nbsp;&nbsp;
      <a href="#M000275">redirect</a>&nbsp;&nbsp;
      <a href="#M000276">sending_file?</a>&nbsp;&nbsp;
      <a href="#M000281">set_cookie</a>&nbsp;&nbsp;
      <a href="#M000280">write</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <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">DEFAULT_HEADERS</td>
          <td>=</td>
          <td class="context-item-value">{ &quot;Cache-Control&quot; =&gt; &quot;no-cache&quot; }</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">assigns</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">layout</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">redirected_to</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">redirected_to_method_params</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">request</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">session</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">template</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</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-M000262" class="method-detail">
        <a name="M000262"></a>

        <div class="method-heading">
          <a href="Response.src/M000262.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000262.html');return false;">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000277" class="method-detail">
        <a name="M000277"></a>

        <div class="method-heading">
          <a href="Response.src/M000277.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000277.html');return false;">
          <span class="method-name">assign_default_content_type_and_charset!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000268" class="method-detail">
        <a name="M000268"></a>

        <div class="method-heading">
          <a href="Response.src/M000268.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000268.html');return false;">
          <span class="method-name">charset</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000267" class="method-detail">
        <a name="M000267"></a>

        <div class="method-heading">
          <a href="Response.src/M000267.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000267.html');return false;">
          <span class="method-name">charset=</span><span class="method-args">(charset)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Set the <a href="Response.html#M000268">charset</a> of the Content-Type
header. Set to nil to remove it. If no content type is set, it defaults to
HTML.
</p>
        </div>
      </div>

      <div id="method-M000266" class="method-detail">
        <a name="M000266"></a>

        <div class="method-heading">
          <a href="Response.src/M000266.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000266.html');return false;">
          <span class="method-name">content_type</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the response&#8216;s content MIME type, or nil if content type has
been set.
</p>
        </div>
      </div>

      <div id="method-M000265" class="method-detail">
        <a name="M000265"></a>

        <div class="method-heading">
          <a href="Response.src/M000265.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000265.html');return false;">
          <span class="method-name">content_type=</span><span class="method-args">(mime_type)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets the HTTP response&#8216;s content MIME type. For example, in the
controller you could <a href="Response.html#M000280">write</a> this:
</p>
<pre>
 response.content_type = &quot;text/plain&quot;
</pre>
<p>
If a character set has been defined for this response (see <a
href="Response.html#M000267">charset=</a>) then the character set
information will also be included in the content type information.
</p>
        </div>
      </div>

      <div id="method-M000279" class="method-detail">
        <a name="M000279"></a>

        <div class="method-heading">
          <a href="Response.src/M000279.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000279.html');return false;">
          <span class="method-name">each</span><span class="method-args">() {|@body| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000272" class="method-detail">
        <a name="M000272"></a>

        <div class="method-heading">
          <a href="Response.src/M000272.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000272.html');return false;">
          <span class="method-name">etag</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000274" class="method-detail">
        <a name="M000274"></a>

        <div class="method-heading">
          <a href="Response.src/M000274.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000274.html');return false;">
          <span class="method-name">etag=</span><span class="method-args">(etag)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000273" class="method-detail">
        <a name="M000273"></a>

        <div class="method-heading">
          <a href="Response.src/M000273.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000273.html');return false;">
          <span class="method-name">etag?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000269" class="method-detail">
        <a name="M000269"></a>

        <div class="method-heading">
          <a href="Response.src/M000269.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000269.html');return false;">
          <span class="method-name">last_modified</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000271" class="method-detail">
        <a name="M000271"></a>

        <div class="method-heading">
          <a href="Response.src/M000271.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000271.html');return false;">
          <span class="method-name">last_modified=</span><span class="method-args">(utc_time)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000270" class="method-detail">
        <a name="M000270"></a>

        <div class="method-heading">
          <a href="Response.src/M000270.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000270.html');return false;">
          <span class="method-name">last_modified?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000263" class="method-detail">
        <a name="M000263"></a>

        <div class="method-heading">
          <a href="Response.src/M000263.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000263.html');return false;">
          <span class="method-name">location</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000264" class="method-detail">
        <a name="M000264"></a>

        <div class="method-heading">
          <a href="Response.src/M000264.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000264.html');return false;">
          <span class="method-name">location=</span><span class="method-args">(url)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000278" class="method-detail">
        <a name="M000278"></a>

        <div class="method-heading">
          <a href="Response.src/M000278.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000278.html');return false;">
          <span class="method-name">prepare!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000275" class="method-detail">
        <a name="M000275"></a>

        <div class="method-heading">
          <a href="Response.src/M000275.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000275.html');return false;">
          <span class="method-name">redirect</span><span class="method-args">(url, status)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000276" class="method-detail">
        <a name="M000276"></a>

        <div class="method-heading">
          <a href="Response.src/M000276.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000276.html');return false;">
          <span class="method-name">sending_file?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000281" class="method-detail">
        <a name="M000281"></a>

        <div class="method-heading">
          <a href="Response.src/M000281.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000281.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-M000280" class="method-detail">
        <a name="M000280"></a>

        <div class="method-heading">
          <a href="Response.src/M000280.html" target="Code" class="method-signature"
            onclick="popupCode('Response.src/M000280.html');return false;">
          <span class="method-name">write</span><span class="method-args">(str)</span>
          </a>
        </div>
      
        <div class="method-description">
        </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>