Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / IServerUtility.cs
blobf865c4ccbdcf455cd5b25430606477d4d5aa279b
1 // Copyright 2004-2007 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 utility methods that web servers provide
21 /// </summary>
22 public interface IServerUtility
24 /// <summary>
25 /// Returns the physical path for the
26 /// specified virtual path.
27 /// </summary>
28 /// <param name="virtualPath">The virtual path.</param>
29 /// <returns>The mapped path</returns>
30 String MapPath(String virtualPath);
32 /// <summary>
33 /// HTML encodes a string and returns the encoded string.
34 /// </summary>
35 /// <param name="content">The text string to HTML encode.</param>
36 /// <returns>The HTML encoded text.</returns>
37 String HtmlEncode(String content);
39 /// <summary>
40 /// URL encodes a string and returns the encoded string.
41 /// </summary>
42 /// <param name="content">The text to URL encode.</param>
43 /// <returns>The URL encoded text.</returns>
44 String UrlEncode(String content);
46 /// <summary>
47 /// URL decodes a string and returns the decoded string.
48 /// </summary>
49 /// <param name="content">The text to URL decode.</param>
50 /// <returns>The URL decoded text.</returns>
51 String UrlDecode(String content);
53 /// <summary>
54 /// URL encodes the path portion of a URL string and returns the encoded string.
55 /// </summary>
56 /// <param name="content">The text to URL encode.</param>
57 /// <returns>The URL encoded text.</returns>
58 String UrlPathEncode(String content);
60 /// <summary>
61 /// Escapes JavaScript with Url encoding and returns the encoded string.
62 /// </summary>
63 /// <remarks>
64 /// Converts quotes, single quotes and CR/LFs to their representation as an escape character.
65 /// </remarks>
66 /// <param name="content">The text to URL encode and escape JavaScript within.</param>
67 /// <returns>The URL encoded and JavaScript escaped text.</returns>
68 String JavaScriptEscape(String content);