1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Gagan Saksena <gagan@netscape.com> (original author)
24 * Darin Fisher <darin@netscape.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsIMutable.idl"
41
42 interface nsIURI;
43
44 /**
45 * nsIStandardURL defines the interface to an URL with the standard
46 * file path format common to protocols like http, ftp, and file.
47 * It supports initialization from a relative path and provides
48 * some customization on how URLs are normalized.
49 *
50 * @status UNDER_REVIEW
51 */
52 [scriptable, uuid(babd6cca-ebe7-4329-967c-d6b9e33caa81)]
53 interface nsIStandardURL : nsIMutable
54 {
55 /**
56 * blah:foo/bar => blah://foo/bar
57 * blah:/foo/bar => blah:///foo/bar
58 * blah://foo/bar => blah://foo/bar
59 * blah:///foo/bar => blah:///foo/bar
60 */
61 const unsigned long URLTYPE_STANDARD = 1;
62
63 /**
64 * blah:foo/bar => blah://foo/bar
65 * blah:/foo/bar => blah://foo/bar
66 * blah://foo/bar => blah://foo/bar
67 * blah:///foo/bar => blah://foo/bar
68 */
69 const unsigned long URLTYPE_AUTHORITY = 2;
70
71 /**
72 * blah:foo/bar => blah:///foo/bar
73 * blah:/foo/bar => blah:///foo/bar
74 * blah://foo/bar => blah://foo/bar
75 * blah:///foo/bar => blah:///foo/bar
76 */
77 const unsigned long URLTYPE_NO_AUTHORITY = 3;
78
79 /**
80 * Initialize a standard URL.
81 *
82 * @param aUrlType - one of the URLTYPE_ flags listed above.
83 * @param aDefaultPort - if the port parsed from the URL string matches
84 * this port, then the port will be removed from the
85 * canonical form of the URL.
86 * @param aSpec - URL string.
87 * @param aOriginCharset - the charset from which this URI string
88 * originated. this corresponds to the charset
89 * that should be used when communicating this
90 * URI to an origin server, for example. if
91 * null, then provide aBaseURI implements this
92 * interface, the origin charset of aBaseURI will
93 * be assumed, otherwise defaulting to UTF-8 (i.e.,
94 * no charset transformation from aSpec).
95 * @param aBaseURI - if null, aSpec must specify an absolute URI.
96 * otherwise, aSpec will be resolved relative
97 * to aBaseURI.
98 */
99 void init(in unsigned long aUrlType,
100 in long aDefaultPort,
101 in AUTF8String aSpec,
102 in string aOriginCharset,
103 in nsIURI aBaseURI);
104 };