C# Class JsonFx.Handlers.ETag

Generates an HTTP/1.1 Cache header Entity Tag (ETag)
HTTP/1.1 RFC: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
Mostrar archivo Open project: pocket-playlab/jsonfx-v1 Class Usage Examples

Public Methods

Method Description
HandleETag ( HttpContext context ) : bool

Verifies if the client has a cached copy of the resource. Sets up HttpResponse appropriately. Returns true if cached.

HandleETag ( HttpContext context, HttpCacheability cacheability ) : bool

Verifies if the client has a cached copy of the resource. Sets up HttpResponse appropriately. Returns true if cached.

HandleETag ( HttpContext context, HttpCacheability cacheability, bool forceRefresh ) : bool

Verifies if the client has a cached copy of the resource. Sets up HttpResponse appropriately. Returns true if cached.

Protected Methods

Method Description
CalculateETag ( ) : string

Sets ETag.Value

ComputeHash ( Stream value ) : string

Generates a unique hash from Stream

ComputeHash ( byte value ) : string

Generates a unique hash from byte[]

ComputeHash ( string value ) : string

Generates a unique hash from string

GetLastModified ( ) : System.DateTime

GetMetaData ( bool &isHash ) : object

Provides an algorithm for generating an HTTP/1.1 Cache header Entity Tag (ETag)

GetMetaData must return String, Byte[], or Stream

Private Methods

Method Description
ETagsEqual ( string etag1, string etag2 ) : bool

see System.Web.StaticFileHandler

FormatBytes ( byte value ) : string

Gets the hex digits for the given bytes

FormatTimeHeader ( System.DateTime time ) : string

Converts a DateTime to a valid header string

Method Details

CalculateETag() protected method

Sets ETag.Value
protected CalculateETag ( ) : string
return string

ComputeHash() protected static method

Generates a unique hash from Stream
protected static ComputeHash ( Stream value ) : string
value Stream
return string

ComputeHash() protected static method

Generates a unique hash from byte[]
protected static ComputeHash ( byte value ) : string
value byte
return string

ComputeHash() protected static method

Generates a unique hash from string
protected static ComputeHash ( string value ) : string
value string
return string

GetLastModified() protected method

protected GetLastModified ( ) : System.DateTime
return System.DateTime

GetMetaData() protected abstract method

Provides an algorithm for generating an HTTP/1.1 Cache header Entity Tag (ETag)
GetMetaData must return String, Byte[], or Stream
protected abstract GetMetaData ( bool &isHash ) : object
isHash bool
return object

HandleETag() public method

Verifies if the client has a cached copy of the resource. Sets up HttpResponse appropriately. Returns true if cached.
public HandleETag ( HttpContext context ) : bool
context System.Web.HttpContext
return bool

HandleETag() public method

Verifies if the client has a cached copy of the resource. Sets up HttpResponse appropriately. Returns true if cached.
public HandleETag ( HttpContext context, HttpCacheability cacheability ) : bool
context System.Web.HttpContext
cacheability HttpCacheability
return bool

HandleETag() public method

Verifies if the client has a cached copy of the resource. Sets up HttpResponse appropriately. Returns true if cached.
public HandleETag ( HttpContext context, HttpCacheability cacheability, bool forceRefresh ) : bool
context System.Web.HttpContext
cacheability HttpCacheability
forceRefresh bool
return bool