forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIResponse.cs
More file actions
80 lines (60 loc) · 2.28 KB
/
IResponse.cs
File metadata and controls
80 lines (60 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//Copyright (c) ServiceStack, Inc. All Rights Reserved.
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
using System.Collections.Generic;
using System.IO;
namespace ServiceStack.Web
{
/// <summary>
/// A thin wrapper around each host's Response e.g: ASP.NET, HttpListener, MQ, etc
/// </summary>
public interface IResponse
{
/// <summary>
/// The underlying ASP.NET or HttpListener HttpResponse
/// </summary>
object OriginalResponse { get; }
IRequest Request { get; }
int StatusCode { get; set; }
string StatusDescription { get; set; }
string ContentType { get; set; }
void AddHeader(string name, string value);
string GetHeader(string name);
void Redirect(string url);
Stream OutputStream { get; }
/// <summary>
/// The Response DTO
/// </summary>
object Dto { get; set; }
/// <summary>
/// Write once to the Response Stream then close it.
/// </summary>
/// <param name="text"></param>
void Write(string text);
/// <summary>
/// Buffer the Response OutputStream so it can be written in 1 batch
/// </summary>
bool UseBufferedStream { get; set; }
/// <summary>
/// Signal that this response has been handled and no more processing should be done.
/// When used in a request or response filter, no more filters or processing is done on this request.
/// </summary>
void Close();
/// <summary>
/// Calls Response.End() on ASP.NET HttpResponse otherwise is an alias for Close().
/// Useful when you want to prevent ASP.NET to provide it's own custom error page.
/// </summary>
void End();
/// <summary>
/// Response.Flush() and OutputStream.Flush() seem to have different behaviour in ASP.NET
/// </summary>
void Flush();
/// <summary>
/// Gets a value indicating whether this instance is closed.
/// </summary>
bool IsClosed { get; }
void SetContentLength(long contentLength);
bool KeepAlive { get; set; }
//Add Metadata to Response
Dictionary<string, object> Items { get; }
}
}