More working tests.
[castle.git] / MonoRail / Castle.MonoRail.Framework / Internal / UrlInfo.cs
blob27d4c582b67f8832fe8fbc92c1c59eb9ecc78a77
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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;
19 /// <summary>
20 /// Represents the tokenized information from an Url.
21 /// </summary>
22 [Serializable]
23 public class UrlInfo
25 private readonly int port;
26 private readonly string domain, subdomain, appVirtualDir, protocol;
27 private readonly string urlRaw;
28 private readonly string area, controller, action, extension;
29 private readonly string pathInfo;
31 /// <summary>
32 /// Initializes a new instance of the <see cref="UrlInfo"/> class.
33 /// </summary>
34 /// <param name="area">The area.</param>
35 /// <param name="controller">The controller.</param>
36 /// <param name="action">The action.</param>
37 public UrlInfo(string area, string controller, string action)
39 this.area = area;
40 this.controller = controller;
41 this.action = action;
44 /// <summary>
45 /// Initializes a new instance of the <see cref="UrlInfo"/> class.
46 /// </summary>
47 /// <param name="area">The area.</param>
48 /// <param name="controller">The controller.</param>
49 /// <param name="action">The action.</param>
50 /// <param name="appVirtualDir">The app virtual dir.</param>
51 /// <param name="extension">The extension.</param>
52 public UrlInfo(string area, string controller, string action, string appVirtualDir, string extension)
54 this.area = area;
55 this.controller = controller;
56 this.action = action;
57 this.appVirtualDir = appVirtualDir;
58 this.extension = extension;
61 /// <summary>
62 /// Initializes a new instance of the <see cref="UrlInfo"/> class.
63 /// </summary>
64 /// <param name="domain">The domain (host).</param>
65 /// <param name="subdomain">The subdomain (first token on the domain).</param>
66 /// <param name="appVirtualDir">The application virtual dir.</param>
67 /// <param name="protocol">Protocol (http/https)</param>
68 /// <param name="port">The port.</param>
69 /// <param name="urlRaw">The raw URL.</param>
70 /// <param name="area">The area, or empty.</param>
71 /// <param name="controller">The controller name.</param>
72 /// <param name="action">The action name.</param>
73 /// <param name="extension">The file extension.</param>
74 /// <param name="pathInfo">The path info.</param>
75 public UrlInfo(string domain, string subdomain, string appVirtualDir, string protocol, int port, string urlRaw,
76 string area, string controller, string action, string extension, string pathInfo)
78 this.port = port;
79 this.domain = domain;
80 this.subdomain = subdomain;
81 this.urlRaw = urlRaw;
82 this.area = area;
83 this.controller = controller;
84 this.action = action;
85 this.extension = extension;
86 this.pathInfo = pathInfo;
87 this.appVirtualDir = appVirtualDir;
88 this.protocol = protocol;
91 /// <summary>
92 /// Gets the app virtual dir.
93 /// </summary>
94 /// <value>The app virtual dir.</value>
95 public string AppVirtualDir
97 get { return appVirtualDir; }
100 /// <summary>
101 /// Gets the port.
102 /// </summary>
103 /// <value>The port.</value>
104 public int Port
106 get { return port; }
109 /// <summary>
110 /// Gets the domain.
111 /// </summary>
112 /// <value>The domain.</value>
113 public string Domain
115 get { return domain; }
118 /// <summary>
119 /// Gets the subdomain.
120 /// </summary>
121 /// <value>The subdomain.</value>
122 public string Subdomain
124 get { return subdomain; }
127 /// <summary>
128 /// Gets the URL raw.
129 /// </summary>
130 /// <value>The URL raw.</value>
131 public string UrlRaw
133 get { return urlRaw; }
136 /// <summary>
137 /// Gets the area.
138 /// </summary>
139 /// <value>The area.</value>
140 public string Area
142 get { return area; }
145 /// <summary>
146 /// Gets the controller.
147 /// </summary>
148 /// <value>The controller.</value>
149 public string Controller
151 get { return controller; }
154 /// <summary>
155 /// Gets the action.
156 /// </summary>
157 /// <value>The action.</value>
158 public string Action
160 get { return action; }
163 /// <summary>
164 /// Gets the protocol.
165 /// </summary>
166 /// <value>The protocol.</value>
167 public string Protocol
169 get { return protocol; }
172 /// <summary>
173 /// The URL extension, without the leading dot.
174 /// </summary>
175 public string Extension
177 get { return extension; }
180 /// <summary>
181 /// Gets the path info.
182 /// </summary>
183 /// <value>The path info.</value>
184 public string PathInfo
186 get { return pathInfo; }