Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From a birds-eye view <a href="http://www.servicestack.net" rel="nofollow">ServiceStack</a> can return any of:</p> <ul> <li>Any DTO object -> serialized to Response ContentType</li> <li>HttpResult, HttpError, CompressedResult (IHttpResult) for Customized HTTP response</li> </ul> <p>The following types are not converted and get written directly to the Response Stream:</p> <ul> <li>String</li> <li>Stream</li> <li>IStreamWriter</li> <li>byte[] - with the <code>application/octet-stream</code> Content Type.</li> </ul> <h3>Details</h3> <p>In addition to returning plain C# objects, ServiceStack allows you to return any <strong>Stream</strong> or IStreamWriter (which is a bit more flexible on how you write to the response stream):</p> <pre class="lang-c# prettyprint-override"><code>public interface IStreamWriter { void WriteTo(Stream stream); } </code></pre> <p>Both though allow you to write directly to the Response OutputStream without any additional conversion overhead.</p> <p>If you want to customize the HTTP headers at the sametime you just need to implement <a href="https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/ServiceHost/IHasOptions.cs" rel="nofollow">IHasOptions</a> where any Dictionary Entry is written to the Response HttpHeaders.</p> <pre class="lang-c# prettyprint-override"><code>public interface IHasOptions { IDictionary&lt;string, string&gt; Options { get; } } </code></pre> <p>Further than that, the IHttpResult allows even finer-grain control of the HTTP output where you can supply a custom Http Response status code. You can refer to the implementation of the <a href="https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Common/Web/HttpResult.cs" rel="nofollow">HttpResult</a> object for a real-world implementation of these above interfaces.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload