title: How to send response using "new Response" or "Response::factory()" in Kohana 3.1?
body: <p>The examples I see are suggesting the use like this:</p>
  
  <pre><code>$response = new Response();
  echo $response-&gt;body($view)-&gt;send_headers()-&gt;body();
  </code></pre>
  
  <p>But if I have the following code </p>
  
  <pre><code>$response = new Response();
  $response-&gt;headers('Content-Type', 'application/json');
  echo $response-&gt;body($view)-&gt;send_headers()-&gt;body();
  </code></pre>
  
  <p>it sends the output allright, but it is in HTML format, not JSON.</p>
  
  <p>Whats the valid way to send a new Response along with headers then? I am using Kohana 3.1 with php 5.3</p>
  
  <p>Edit: </p>
  
  <p>Before you start thinking what a fool I am for not using <code>$this-&gt;response-&gt;body(&lt;blah here&gt;);</code>, let me clarify that I know how to use the controller's response object... That is not what I am looking for... I want to send a response entirely from a static function that is not anywhere near a controller in the function call stack :)</p>