Show / Hide Table of Contents

Class Response

Represents Response object used to generate web responses to client

Inheritance
System.Object
DisposableObject
Response
Implements
System.IDisposable
Inherited Members
DisposableObject.DisposeAndNull<T>(T)
DisposableObject.DisposeStarted
DisposableObject.Disposed
DisposableObject.EnsureObjectNotDisposed()
DisposableObject.Dispose()
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()
Namespace: NFX.Wave
Assembly: NFX.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
Type Description
WorkContext

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

Http content type

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

Headers

Returns http headers of the response

Declaration
public WebHeaderCollection Headers { get; }
Property Value
Type Description
System.Net.WebHeaderCollection

StatusCode

Http status code

Declaration
public int StatusCode { get; set; }
Property Value
Type Description
System.Int32

StatusDescription

Http status description

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

AddHeader(String, String)

Adds Http header

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
DisposableObject.Destructor()

Flush()

RESERVED FOR FUTURE USE. Flushes the internally buffered content

Declaration
public void Flush()

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 beeing 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
Type Name Description
System.String url
WebConsts.RedirectCode code

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
Type Name Description
System.String url
WebConsts.RedirectCode code

SetCacheControlHeaders(CacheControl, Boolean, String)

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

SetNoCacheHeaders(Boolean)

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
Type Name Description
System.Object data
JSONWritingOptions options

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

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX