C# Class NCombo.ComboHandler

Inheritance: BaseHttpHandler
ファイルを表示 Open project: gmoothart/NCombo Class Usage Examples

Public Methods

Method Description
HandleRequest ( System.Web.HttpContextBase context ) : void
SetResponseCachePolicy ( System.Web.HttpCachePolicyBase cache ) : void
ValidateParameters ( System.Web.HttpContextBase context ) : bool

Validate query string. At this stage, just make sure it exists.

fixupCss ( string path, string contents ) : string

When combo-loading, css paths get mixed up. Must fix that

Regular Expressions and logic inspired by the PHP Loader: https://github.com/yui/phploader/blob/master/phploader/combo.php

getCacheFilename ( string query, bool withGzip, System.Web.HttpServerUtilityBase server ) : string

Calculate a unique filename representing this request.

isClientGzipEnabled ( System.Web.HttpRequestBase rq ) : bool

Protected Methods

Method Description
Init ( System.Web.HttpContextBase context ) : void

Private Methods

Method Description
GzipFile ( string sourceFilename, string destFilename ) : void

Gzip the source file to the dest filename.

Borrowed mostly from: http://msdn.microsoft.com/en-us/library/ms404280(v=VS.85).aspx There is a somewhat simpler method in .Net 4, using CopyTo: http://msdn.microsoft.com/en-us/library/ms404280.aspx I am not sure what difference, if any, it makes on performance.

allowedByWhitelist ( string relPath ) : bool
pathIsCSS ( string path ) : bool

Method Details

HandleRequest() public method

public HandleRequest ( System.Web.HttpContextBase context ) : void
context System.Web.HttpContextBase
return void

Init() protected method

protected Init ( System.Web.HttpContextBase context ) : void
context System.Web.HttpContextBase
return void

SetResponseCachePolicy() public method

public SetResponseCachePolicy ( System.Web.HttpCachePolicyBase cache ) : void
cache System.Web.HttpCachePolicyBase
return void

ValidateParameters() public method

Validate query string. At this stage, just make sure it exists.
public ValidateParameters ( System.Web.HttpContextBase context ) : bool
context System.Web.HttpContextBase
return bool

fixupCss() public method

When combo-loading, css paths get mixed up. Must fix that
Regular Expressions and logic inspired by the PHP Loader: https://github.com/yui/phploader/blob/master/phploader/combo.php
public fixupCss ( string path, string contents ) : string
path string
contents string
return string

getCacheFilename() public method

Calculate a unique filename representing this request.
public getCacheFilename ( string query, bool withGzip, System.Web.HttpServerUtilityBase server ) : string
query string
withGzip bool
server System.Web.HttpServerUtilityBase
return string

isClientGzipEnabled() public method

public isClientGzipEnabled ( System.Web.HttpRequestBase rq ) : bool
rq System.Web.HttpRequestBase
return bool