nsIHttpServer.idl
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is the httpd.js server.
15  *
16  * The Initial Developer of the Original Code is
17  * Mozilla Corporation.
18  * Portions created by the Initial Developer are Copyright (C) 2006
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  * Jeff Walden <jwalden+code@mit.edu> (original author)
23  * Robert Sayre <sayrer@gmail.com>
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38 
39 #include "nsIPropertyBag.idl"
40 
41 interface nsIInputStream;
42 interface nsILocalFile;
43 interface nsIOutputStream;
44 interface nsISimpleEnumerator;
45 
46 interface nsIHttpServer;
48 interface nsIHttpRequestHandler;
49 interface nsIHttpRequestMetadata;
50 interface nsIHttpResponse;
51 interface nsIHttpServerIdentity;
52 
56 [scriptable, uuid(79e0d43a-1dd2-11b2-870f-f94d22a28b27)]
58 {
76  void start(in long port);
77 
91 
103  void registerFile(in string path, in nsILocalFile file);
104 
121  void registerPathHandler(in string path, in nsIHttpRequestHandler handler);
122 
139  void registerPrefixHandler(in string prefix, in nsIHttpRequestHandler handler);
140 
158  void registerErrorHandler(in unsigned long code, in nsIHttpRequestHandler handler);
159 
177  void registerDirectory(in string path, in nsILocalFile dir);
178 
198  void registerContentType(in string extension, in string type);
199 
213  void setIndexHandler(in nsIHttpRequestHandler handler);
214 
216  readonly attribute nsIHttpServerIdentity identity;
217 
223  AString getState(in AString path, in AString key);
224 
229  void setState(in AString path, in AString key, in AString value);
230 
236  AString getSharedState(in AString key);
237 
242  void setSharedState(in AString key, in AString value);
243 
248  nsISupports getObjectState(in AString key);
249 
254  void setObjectState(in AString key, in nsISupports value);
255 };
256 
262 [scriptable, function, uuid(925a6d33-9937-4c63-abe1-a1c56a986455)]
264 {
266  void onStopped();
267 };
268 
277 [scriptable, uuid(a89de175-ae8e-4c46-91a5-0dba99bbd284)]
279 {
290  readonly attribute string primaryScheme;
291 
302  readonly attribute string primaryHost;
303 
314  readonly attribute long primaryPort;
315 
323  void add(in string scheme, in string host, in long port);
324 
336  PRBool remove(in string scheme, in string host, in long port);
337 
345  PRBool has(in string scheme, in string host, in long port);
346 
355  string getScheme(in string host, in long port);
356 
365  void setPrimary(in string scheme, in string host, in long port);
366 };
367 
379 [scriptable, function, uuid(2bbb4db7-d285-42b3-a3ce-142b8cc7e139)]
381 {
404  void handle(in nsIHttpRequestMetadata metadata, in nsIHttpResponse response);
405 };
406 
407 
411 [scriptable, uuid(80cbca71-dc51-4fa0-9010-1cec262dbd4a)]
412 interface nsIHttpRequestMetadata : nsIPropertyBag
413 {
417  readonly attribute string method;
418 
426  readonly attribute string scheme;
427 
434  readonly attribute string host;
435 
439  readonly attribute unsigned long port;
440 
446  readonly attribute string path;
447 
452  readonly attribute string queryString;
453 
460  readonly attribute string httpVersion;
461 
480  string getHeader(in string fieldName);
481 
493  boolean hasHeader(in string fieldName);
494 
500  readonly attribute nsISimpleEnumerator headers;
501 
505  readonly attribute nsIInputStream bodyInputStream;
506 };
507 
508 
512 [scriptable, uuid(1acd16c2-dc59-42fa-9160-4f26c43c1c21)]
514 {
536  void setStatusLine(in string httpVersion,
537  in unsigned short statusCode,
538  in string description);
539 
563  void setHeader(in string name, in string value, in boolean merge);
564 
586  readonly attribute nsIOutputStream bodyOutputStream;
587 
598  void write(in string data);
599 
617  void processAsync();
618 
640  void seizePower();
641 
652  void finish();
653 };
string getHeader(in string fieldName)
readonly attribute string scheme
readonly attribute string path
readonly attribute string primaryHost
void add(in string scheme, in string host, in long port)
void handle(in nsIHttpRequestMetadata metadata, in nsIHttpResponse response)
void registerPathHandler(in string path, in nsIHttpRequestHandler handler)
void setState(in AString path, in AString key, in AString value)
readonly attribute long primaryPort
void setHeader(in string name, in string value, in boolean merge)
void registerErrorHandler(in unsigned long code, in nsIHttpRequestHandler handler)
void setStatusLine(in string httpVersion, in unsigned short statusCode, in string description)
readonly attribute nsISimpleEnumerator headers
boolean hasHeader(in string fieldName)
void setObjectState(in AString key, in nsISupports value)
void setPrimary(in string scheme, in string host, in long port)
readonly attribute string method
readonly attribute nsIOutputStream bodyOutputStream
readonly attribute string primaryScheme
PRBool has(in string scheme, in string host, in long port)
var uuid
void write(in string data)
readonly attribute unsigned long port
readonly attribute nsIHttpServerIdentity identity
void setIndexHandler(in nsIHttpRequestHandler handler)
void setSharedState(in AString key, in AString value)
void registerContentType(in string extension, in string type)
grep callback
void registerDirectory(in string path, in nsILocalFile dir)
void stop(in nsIHttpServerStoppedCallback callback)
AString getState(in AString path, in AString key)
AString getSharedState(in AString key)
string getScheme(in string host, in long port)
countRef value
Definition: FeedWriter.js:1423
readonly attribute string queryString
readonly attribute string host
void registerPrefixHandler(in string prefix, in nsIHttpRequestHandler handler)
readonly attribute nsIInputStream bodyInputStream
observe data
Definition: FeedWriter.js:1329
void registerFile(in string path, in nsILocalFile file)
GstMessage gpointer data sbGStreamerMessageHandler * handler
void start(in long port)
nsISupports getObjectState(in AString key)
var file
readonly attribute string httpVersion