1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
17 using System
.Collections
;
18 using System
.Collections
.Specialized
;
21 /// THe UrlBuilder service centralizes the url generation used by the whole
22 /// framework including redirect urls, urls generated by helpers and so on.
23 /// It offers a central place to change MonoRail behavior on how to deal with urls.
25 public interface IUrlBuilder
28 /// Builds the URL using the current url as contextual information and a parameter dictionary.
30 /// Common parameters includes area, controller and action.
33 /// <param name="current">The current Url information.</param>
34 /// <param name="parameters">The parameters.</param>
35 /// <returns></returns>
36 UrlPartsBuilder
CreateUrlPartsBuilder(UrlInfo current
, IDictionary parameters
);
39 /// Builds the URL using the current url as contextual information and a parameter dictionary.
41 /// Common parameters includes area, controller and action.
44 /// <param name="current">The current Url information.</param>
45 /// <param name="parameters">The parameters.</param>
46 /// <returns></returns>
47 string BuildUrl(UrlInfo current
, IDictionary parameters
);
50 /// Builds an URL using the controller name and action name.
52 /// <param name="current">The current Url information.</param>
53 /// <param name="controller">The controller.</param>
54 /// <param name="action">The action.</param>
55 /// <returns></returns>
56 string BuildUrl(UrlInfo current
, string controller
, string action
);
59 /// Builds an URL using the controller name, action name, and a querystring dictionary.
61 /// <param name="current">The current Url information.</param>
62 /// <param name="controller">The controller.</param>
63 /// <param name="action">The action.</param>
64 /// <param name="queryStringParams">The query string params.</param>
65 /// <returns></returns>
66 string BuildUrl(UrlInfo current
, string controller
, string action
, IDictionary queryStringParams
);
69 /// Builds an URL using the controller name, action name, and a querystring name value collection.
71 /// <param name="current">The current Url information.</param>
72 /// <param name="controller">The controller.</param>
73 /// <param name="action">The action.</param>
74 /// <param name="queryStringParams">The query string params.</param>
75 /// <returns></returns>
76 string BuildUrl(UrlInfo current
, string controller
, string action
, NameValueCollection queryStringParams
);
79 /// Builds an URL using the area name, controller name and action name.
81 /// <param name="current">The current Url information.</param>
82 /// <param name="area">The area.</param>
83 /// <param name="controller">The controller.</param>
84 /// <param name="action">The action.</param>
85 /// <returns></returns>
86 string BuildUrl(UrlInfo current
, string area
, string controller
, string action
);
89 /// Builds an URL using the area name, controller name, action name, and a querystring dictionary.
91 /// <param name="current">The current Url information.</param>
92 /// <param name="area">The area.</param>
93 /// <param name="controller">The controller.</param>
94 /// <param name="action">The action.</param>
95 /// <param name="queryStringParams">The query string params.</param>
96 /// <returns></returns>
97 string BuildUrl(UrlInfo current
, string area
, string controller
, string action
, IDictionary queryStringParams
);
100 /// Builds an URL using the area name, controller name, action name, and a querystring name value collection.
102 /// <param name="current">The current Url information.</param>
103 /// <param name="area">The area.</param>
104 /// <param name="controller">The controller.</param>
105 /// <param name="action">The action.</param>
106 /// <param name="queryStringParams">The query string params.</param>
107 /// <returns></returns>
108 string BuildUrl(UrlInfo current
, string area
, string controller
, string action
, NameValueCollection queryStringParams
);
113 /// <param name="current">The current.</param>
114 /// <param name="routeName">Name of the route.</param>
115 /// <returns></returns>
116 string BuildRouteUrl(UrlInfo current
, string routeName
);
121 /// <param name="current">The current.</param>
122 /// <param name="routeName">Name of the route.</param>
123 /// <param name="parameters">The parameters.</param>
124 /// <returns></returns>
125 string BuildRouteUrl(UrlInfo current
, string routeName
, IDictionary parameters
);
130 /// <param name="current">The current.</param>
131 /// <param name="routeName">Name of the route.</param>
132 /// <param name="parameters">The parameters.</param>
133 /// <returns></returns>
134 string BuildRouteUrl(UrlInfo current
, string routeName
, object parameters
);