Class Response
Represents Response object used to generate web responses to client
Inheritance
System.Object
Response
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Azos.Wave.dll
Syntax
public sealed class Response : DisposableObject, IDisposable
Fields
DEFAULT_DOWNLOAD_BUFFER_SIZE
Declaration
public const int DEFAULT_DOWNLOAD_BUFFER_SIZE = 131072
Field Value
Type |
Description |
System.Int32 |
|
MAX_DOWNLOAD_BUFFER_SIZE
Declaration
public const int MAX_DOWNLOAD_BUFFER_SIZE = 1048576
Field Value
Type |
Description |
System.Int32 |
|
MAX_DOWNLOAD_FILE_SIZE
Declaration
public const int MAX_DOWNLOAD_FILE_SIZE = 33554432
Field Value
Type |
Description |
System.Int32 |
|
MIN_DOWNLOAD_BUFFER_SIZE
Declaration
public const int MIN_DOWNLOAD_BUFFER_SIZE = 1024
Field Value
Type |
Description |
System.Int32 |
|
Work
Declaration
public readonly WorkContext Work
Field Value
Properties
Buffered
Determines whether the content is buffered locally. This property can not be set after
the response has been written to
Declaration
public bool Buffered { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
ClientVarsChanged
Returns true if current request processing cycle has changed the client var
Declaration
public bool ClientVarsChanged { get; }
Property Value
Type |
Description |
System.Boolean |
|
ContentType
Declaration
public string ContentType { get; set; }
Property Value
Type |
Description |
System.String |
|
Encoding
Gets/sets content encoding
Declaration
public Encoding Encoding { get; set; }
Property Value
Type |
Description |
System.Text.Encoding |
|
Returns http headers of the response
Declaration
public WebHeaderCollection Headers { get; }
Property Value
Type |
Description |
System.Net.WebHeaderCollection |
|
StatusCode
Declaration
public int StatusCode { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
StatusDescription
Declaration
public string StatusDescription { get; set; }
Property Value
Type |
Description |
System.String |
|
WasWrittenTo
Returns true if some output has been performed
Declaration
public bool WasWrittenTo { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
Declaration
public void AddHeader(string name, string value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.String |
value |
|
AppendCookie(Cookie)
Appends cookie to the response
Declaration
public void AppendCookie(Cookie cookie)
Parameters
Type |
Name |
Description |
System.Net.Cookie |
cookie |
|
CancelBuffered()
Cancels the buffered content. Throws if the response is not Buffered
Declaration
public void CancelBuffered()
Destructor()
Declaration
protected override void Destructor()
Overrides
Flush()
RESERVED FOR FUTURE USE. Flushes the internally buffered content
Declaration
GetClientVar(String)
Provides access to client state object which gets persisted as a cookie.
Client states need to be used instead of cookies because of some HttpListener+Browser limitations
that can not parse multiple cookies set into one Set-Cookie header
Declaration
public string GetClientVar(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.String |
|
GetClientVarNames()
Provides access to client state object which gets persisted as a cookie.
Client states need to be used instead of cookies because of some HttpListener+Browser limitations
that can not parse multiple cookies set into one Set-Cookie header
Declaration
public IEnumerable<string> GetClientVarNames()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
GetDirectOutputStreamForWriting()
Returns output stream for direct output and marks response as being written into
Declaration
public Stream GetDirectOutputStreamForWriting()
Returns
Type |
Description |
System.IO.Stream |
|
Redirect(String, WebConsts.RedirectCode)
Configures response with redirect status and headers. This method DOES NOT ABORT the work pipeline,so
the processing of filters and handlers continues unless 'work.Aborted = true' is issued in code.
See also 'RedirectAndAbort(url)'
Declaration
public void Redirect(string url, WebConsts.RedirectCode code = WebConsts.RedirectCode.Found_302)
Parameters
RedirectAndAbort(String, WebConsts.RedirectCode)
Configures response with redirect status and headers. This method also aborts the work pipeline,so
the processing of filters and handlers does not continue. See also 'Redirect(url)'
Declaration
public void RedirectAndAbort(string url, WebConsts.RedirectCode code = WebConsts.RedirectCode.Found_302)
Parameters
Declaration
public bool SetCacheControlHeaders(CacheControl control, bool force = true, string vary = null)
Parameters
Type |
Name |
Description |
CacheControl |
control |
|
System.Boolean |
force |
|
System.String |
vary |
|
Returns
Type |
Description |
System.Boolean |
|
SetClientVar(String, String)
Provides access to client state object which gets persisted as a cookie.
Client states need to be used instead of cookies because of some HttpListener+Browser limitations
that can not parse multiple cookies set into one Set-Cookie header.
Pass null for value to delete the var form the collection. The values are generally expected to be base64 encoded by the caller
Declaration
public void SetClientVar(string key, string value)
Parameters
Type |
Name |
Description |
System.String |
key |
|
System.String |
value |
|
Sets headers so all downstream, layers (browsers, proxies) do not cache response.
If Force==true(default) then overrides existing headers with no cache.
Returns true when headers were set
Declaration
public bool SetNoCacheHeaders(bool force = true)
Parameters
Type |
Name |
Description |
System.Boolean |
force |
|
Returns
Type |
Description |
System.Boolean |
|
Write(Object)
Writes an object into response as string
Declaration
public void Write(object content)
Parameters
Type |
Name |
Description |
System.Object |
content |
|
Write(String)
Writes a string into response
Declaration
public void Write(string content)
Parameters
Type |
Name |
Description |
System.String |
content |
|
WriteFile(String, Int32, Boolean)
Write the file to the client so client can download it. May set Buffered=false to use chunked encoding for big files
Declaration
public void WriteFile(string localFileName, int bufferSize = 131072, bool attachment = false)
Parameters
Type |
Name |
Description |
System.String |
localFileName |
|
System.Int32 |
bufferSize |
|
System.Boolean |
attachment |
|
WriteJSON(Object, JSONWritingOptions)
Writes an object as JSON. Does nothing if object is null
Declaration
public void WriteJSON(object data, JSONWritingOptions options = null)
Parameters
WriteLine(Object)
Writes an object into response as string
Declaration
public void WriteLine(object content)
Parameters
Type |
Name |
Description |
System.Object |
content |
|
WriteLine(String)
Writes a string into response
Declaration
public void WriteLine(string content)
Parameters
Type |
Name |
Description |
System.String |
content |
|
WriteStream(Stream, Int32, String)
Write the contents of the stream to the client so client can download it. May set Buffered=false to use chunked encoding for big files
Declaration
public void WriteStream(Stream stream, int bufferSize = 131072, string attachmentName = null)
Parameters
Type |
Name |
Description |
System.IO.Stream |
stream |
|
System.Int32 |
bufferSize |
|
System.String |
attachmentName |
|
Implements
System.IDisposable
Extension Methods