Songbird / Development / Songbird Add-Ons API Documentation

components/testharness/public/nsIHttpServer.idl

00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the MozJSHTTP server.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Mozilla Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2006
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Jeff Walden <jwalden+code@mit.edu>          (original author)
00023  *   Robert Sayre <sayrer@gmail.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsIServerSocket.idl"
00040 #include "nsIPropertyBag.idl"
00041 
00042 interface nsILocalFile;
00043 interface nsISimpleEnumerator;
00044 interface nsIOutputStream;
00045 
00046 interface nsIHttpServer;
00047 interface nsIHttpRequestHandler;
00048 interface nsIHttpRequestMetadata;
00049 interface nsIHttpResponse;
00050 
00055 [scriptable, uuid(5520f79e-ecd5-4c40-843b-97ee13a23747)]
00056 interface nsIHttpServer : nsIServerSocketListener
00057 {
00068   void start(in long port);
00069 
00081   void stop();
00082 
00094   void registerFile(in string path, in nsILocalFile file);
00095 
00112   void registerPathHandler(in string path, in nsIHttpRequestHandler handler);
00113 
00131   void registerErrorHandler(in unsigned long code, in nsIHttpRequestHandler handler);
00132 
00150   void registerDirectory(in string path, in nsILocalFile dir);
00151 
00165   void setIndexHandler(in nsIHttpRequestHandler handler);
00166 };
00167 
00182 [scriptable, function, uuid(2bbb4db7-d285-42b3-a3ce-142b8cc7e139)]
00183 interface nsIHttpRequestHandler : nsISupports
00184 {
00199   void handle(in nsIHttpRequestMetadata metadata, in nsIHttpResponse response);
00200 };
00201 
00202 
00207 [scriptable, uuid(3a899b17-b6eb-4333-8ef4-912df454a551)]
00208 interface nsIHttpRequestMetadata : nsIPropertyBag
00209 {
00213   readonly attribute string method;
00214   
00220   readonly attribute string host;
00221 
00225   readonly attribute unsigned long port;
00226 
00231   readonly attribute string path;
00232 
00237   readonly attribute string queryString;
00238 
00245   readonly attribute string httpVersion;
00246 
00264   string getHeader(in string fieldName);
00265 
00277   boolean hasHeader(in string fieldName);
00278 
00284   readonly attribute nsISimpleEnumerator headers;
00285 
00286   // XXX should expose body of request here!
00287 };
00288 
00289 
00294 [scriptable, uuid(a2aaaff7-03bd-43b6-b460-94671e288093)]
00295 interface nsIHttpResponse : nsISupports
00296 {
00314   void setStatusLine(in string httpVersion,
00315                      in unsigned short statusCode,
00316                      in string description);
00317 
00335   void setHeader(in string name, in string value, in boolean merge);
00336 
00341   readonly attribute nsIOutputStream bodyOutputStream;
00342 
00349   void write(in string data);
00350 };

Generated on Tue Mar 10 14:28:55 2009 for Songbird by  doxygen 1.5.2