C# 클래스 Castle.MonoRail.Framework.Services.DefaultUrlBuilder

Default implementation of IUrlBuilder
The property UseExtensions defines whether the builder should output file extension. This might be handy to use in combination with a url rewrite strategy

If you want to create a custom urlbuilder, you can extend this one and override the InternalBuildUrl(string,string,string,string,string,string,string,string,string,bool,bool,string)

상속: IUrlBuilder, IServiceEnabledComponent
파일 보기 프로젝트 열기: nats/castle-1.0.3-mono 1 사용 예제들

공개 메소드들

메소드 설명
BuildUrl ( System.UrlInfo current, IDictionary parameters ) : string

Builds the URL using the current url as contextual information and a parameter dictionary.

Common parameters includes area, controller and action, which outputs /area/controller/name.extension

Please note that if you dont specify an area or controller name, they will be inferred from the context. If you want to use an empty area, you must specify area=''. This is commonly a source of confusion, so understand the following cases:

UrlInfo current = ... // Assume that the current is area Admin, controller Products and action List BuildUrl(current, {action: 'view'}) // returns /Admin/Products/view.castle BuildUrl(current, {controller: 'Home', action: 'index'}) // returns /Admin/Home/index.castle BuildUrl(current, {area:'', controller: 'Home', action: 'index'}) // returns /Home/index.castle

The querystring parameter can be a string or a dictionary. It appends a query string to the url: /area/controller/name.extension?id=1

The absolute parameter forces the builder to output a full url like http://hostname/virtualdir/area/controller/name.extension

The encode parameter forces the builder to encode the querystring /controller/name.extension?id=1&name=John which is required to output full xhtml compliant content.

BuildUrl ( System.UrlInfo current, string controller, string action ) : string

Builds an URL using the controller name and action name.

BuildUrl ( System.UrlInfo current, string controller, string action, IDictionary queryStringParams ) : string

Builds an URL using the controller name, action name, and a querystring dictionary.

BuildUrl ( System.UrlInfo current, string controller, string action, NameValueCollection queryStringParams ) : string

Builds an URL using the controller name, action name, and a querystring name value collection.

BuildUrl ( System.UrlInfo current, string area, string controller, string action ) : string

Builds an URL using the area name, controller name and action name.

BuildUrl ( System.UrlInfo current, string area, string controller, string action, IDictionary queryStringParams ) : string

Builds an URL using the area name, controller name, action name, and a querystring dictionary.

BuildUrl ( System.UrlInfo current, string area, string controller, string action, NameValueCollection queryStringParams ) : string

Builds an URL using the area name, controller name, action name, and a querystring name value collection.

DefaultUrlBuilder ( ) : System

Initializes a new instance of the DefaultUrlBuilder class.

Service ( IServiceProvider provider ) : void

Services the specified provider.

보호된 메소드들

메소드 설명
InternalBuildUrl ( string area, string controller, string action, string protocol, string port, string domain, string subdomain, string appVirtualDir, string extension, bool absolutePath, bool applySubdomain, string suffix ) : string

Internals the build URL.

InternalBuildUrl ( string area, string controller, string action, string protocol, string port, string domain, string subdomain, string appVirtualDir, string extension, bool absolutePath, bool applySubdomain, string suffix, string basePath ) : string

Internals the build URL.

비공개 메소드들

메소드 설명
InternalBuildUrlUsingBasePath ( string action, string area, string basePath, string controller ) : string

Internals the build URL using base path.

InternalBuildUsingAppVirtualDir ( bool absolutePath, string action, bool applySubdomain, string appVirtualDir, string area, string controller, string domain, string port, string protocol, string subdomain ) : string

Internals the build using app virtual dir.

메소드 상세

BuildUrl() 공개 메소드

Builds the URL using the current url as contextual information and a parameter dictionary.

Common parameters includes area, controller and action, which outputs /area/controller/name.extension

Please note that if you dont specify an area or controller name, they will be inferred from the context. If you want to use an empty area, you must specify area=''. This is commonly a source of confusion, so understand the following cases:

UrlInfo current = ... // Assume that the current is area Admin, controller Products and action List BuildUrl(current, {action: 'view'}) // returns /Admin/Products/view.castle BuildUrl(current, {controller: 'Home', action: 'index'}) // returns /Admin/Home/index.castle BuildUrl(current, {area:'', controller: 'Home', action: 'index'}) // returns /Home/index.castle

The querystring parameter can be a string or a dictionary. It appends a query string to the url: /area/controller/name.extension?id=1

The absolute parameter forces the builder to output a full url like http://hostname/virtualdir/area/controller/name.extension

The encode parameter forces the builder to encode the querystring /controller/name.extension?id=1&name=John which is required to output full xhtml compliant content.

public BuildUrl ( System.UrlInfo current, IDictionary parameters ) : string
current System.UrlInfo The current Url information.
parameters IDictionary The parameters.
리턴 string

BuildUrl() 공개 메소드

Builds an URL using the controller name and action name.
public BuildUrl ( System.UrlInfo current, string controller, string action ) : string
current System.UrlInfo The current Url information.
controller string The controller.
action string The action.
리턴 string

BuildUrl() 공개 메소드

Builds an URL using the controller name, action name, and a querystring dictionary.
public BuildUrl ( System.UrlInfo current, string controller, string action, IDictionary queryStringParams ) : string
current System.UrlInfo The current Url information.
controller string The controller.
action string The action.
queryStringParams IDictionary The query string params.
리턴 string

BuildUrl() 공개 메소드

Builds an URL using the controller name, action name, and a querystring name value collection.
public BuildUrl ( System.UrlInfo current, string controller, string action, NameValueCollection queryStringParams ) : string
current System.UrlInfo The current Url information.
controller string The controller.
action string The action.
queryStringParams System.Collections.Specialized.NameValueCollection The query string params.
리턴 string

BuildUrl() 공개 메소드

Builds an URL using the area name, controller name and action name.
public BuildUrl ( System.UrlInfo current, string area, string controller, string action ) : string
current System.UrlInfo The current Url information.
area string The area.
controller string The controller.
action string The action.
리턴 string

BuildUrl() 공개 메소드

Builds an URL using the area name, controller name, action name, and a querystring dictionary.
public BuildUrl ( System.UrlInfo current, string area, string controller, string action, IDictionary queryStringParams ) : string
current System.UrlInfo The current Url information.
area string The area.
controller string The controller.
action string The action.
queryStringParams IDictionary The query string params.
리턴 string

BuildUrl() 공개 메소드

Builds an URL using the area name, controller name, action name, and a querystring name value collection.
public BuildUrl ( System.UrlInfo current, string area, string controller, string action, NameValueCollection queryStringParams ) : string
current System.UrlInfo The current Url information.
area string The area.
controller string The controller.
action string The action.
queryStringParams System.Collections.Specialized.NameValueCollection The query string params.
리턴 string

DefaultUrlBuilder() 공개 메소드

Initializes a new instance of the DefaultUrlBuilder class.
public DefaultUrlBuilder ( ) : System
리턴 System

InternalBuildUrl() 보호된 메소드

Internals the build URL.
protected InternalBuildUrl ( string area, string controller, string action, string protocol, string port, string domain, string subdomain, string appVirtualDir, string extension, bool absolutePath, bool applySubdomain, string suffix ) : string
area string The area.
controller string The controller.
action string The action.
protocol string The protocol.
port string The port.
domain string The domain.
subdomain string The subdomain.
appVirtualDir string The app virtual dir.
extension string The extension.
absolutePath bool if set to true [absolute path].
applySubdomain bool if set to true [apply subdomain].
suffix string The suffix.
리턴 string

InternalBuildUrl() 보호된 메소드

Internals the build URL.
protected InternalBuildUrl ( string area, string controller, string action, string protocol, string port, string domain, string subdomain, string appVirtualDir, string extension, bool absolutePath, bool applySubdomain, string suffix, string basePath ) : string
area string The area.
controller string The controller.
action string The action.
protocol string The protocol.
port string The port.
domain string The domain.
subdomain string The subdomain.
appVirtualDir string The app virtual dir.
extension string The extension.
absolutePath bool if set to true [absolute path].
applySubdomain bool if set to true [apply subdomain].
suffix string The suffix.
basePath string The base path.
리턴 string

Service() 공개 메소드

Services the specified provider.
public Service ( IServiceProvider provider ) : void
provider IServiceProvider The provider.
리턴 void