C# Class ImageMagick.Web.Handlers.MagickHandler

Base class for IHttpHandlers that use the IUrlResolver class.
Inheritance: IHttpHandler, IRequiresSessionState
显示文件 Open project: dlemstra/Magick.NET

Public Methods

Method Description
ProcessRequest ( HttpContext context ) : void

Enables processing of HTTP Web requests by a custom HttpHandler that implements the IHttpHandler interface.

Protected Methods

Method Description
CanUseCache ( string cacheFileName ) : bool

Returns true if the cache file is newer then the file name that was resolved by the IUrlResolver.

GetCacheFileName ( string directoryName, string subdirectoryKey ) : string

Returns the file name that can be used to cache the result.

MagickHandler ( IUrlResolver urlResolver, MagickFormatInfo formatInfo ) : System

Initializes a new instance of the MagickHandler class.

MoveToCache ( string fileName, string cacheFileName ) : void

Moves to the specified source file name to the destination file name. This is happening in a lock to avoid problems when an other request is reading the file.

WriteFile ( HttpContext context ) : void

Writes the file to the response.

WriteFile ( HttpContext context, string fileName ) : void

Writes the specified file to the response.

Private Methods

Method Description
AddCacheControlHeader ( HttpResponse response ) : void
CalculateMD5 ( string value ) : string
GetTempFileName ( ) : string
InitializeVersion ( ) : string
Write304 ( HttpContext content, System.DateTime fileDate ) : bool

Method Details

CanUseCache() protected method

Returns true if the cache file is newer then the file name that was resolved by the IUrlResolver.
protected CanUseCache ( string cacheFileName ) : bool
cacheFileName string
return bool

GetCacheFileName() protected method

Returns the file name that can be used to cache the result.
protected GetCacheFileName ( string directoryName, string subdirectoryKey ) : string
directoryName string The name of the subdirectory to store the files in.
subdirectoryKey string The key that will be used to create MD5 hash and that /// will be used as a sub directory.
return string

MagickHandler() protected method

Initializes a new instance of the MagickHandler class.
protected MagickHandler ( IUrlResolver urlResolver, MagickFormatInfo formatInfo ) : System
urlResolver IUrlResolver
formatInfo MagickFormatInfo
return System

MoveToCache() protected static method

Moves to the specified source file name to the destination file name. This is happening in a lock to avoid problems when an other request is reading the file.
protected static MoveToCache ( string fileName, string cacheFileName ) : void
fileName string
cacheFileName string
return void

ProcessRequest() public method

Enables processing of HTTP Web requests by a custom HttpHandler that implements the IHttpHandler interface.
public ProcessRequest ( HttpContext context ) : void
context System.Web.HttpContext An HttpContext object that provides references to the intrinsic /// server objects (for example, Request, Response, Session, and Server) used to service /// HTTP requests.
return void

WriteFile() protected abstract method

Writes the file to the response.
protected abstract WriteFile ( HttpContext context ) : void
context System.Web.HttpContext
return void

WriteFile() protected static method

Writes the specified file to the response.
protected static WriteFile ( HttpContext context, string fileName ) : void
context System.Web.HttpContext
fileName string
return void