PageRenderTime 122ms CodeModel.GetById 81ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/gecko_sdk/idl/nsIUploadChannel.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 90 lines | 10 code | 4 blank | 76 comment | 0 complexity | 3a51289f426b6a3dea616277c3d0e8fb MD5 | raw file
 1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 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 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#include "nsISupports.idl"
39
40interface nsIInputStream;
41
42/**
43 * nsIUploadChannel
44 *
45 * A channel may optionally implement this interface if it supports the
46 * notion of uploading a data stream.  The upload stream may only be set
47 * prior to the invocation of asyncOpen on the channel.
48 *
49 * @status FROZEN
50 */
51[scriptable, uuid(ddf633d8-e9a4-439d-ad88-de636fd9bb75)]
52interface nsIUploadChannel : nsISupports
53{
54    /**
55     * Sets a stream to be uploaded by this channel.
56     *
57     * Most implementations of this interface require that the stream:
58     *   (1) implement threadsafe addRef and release
59     *   (2) implement nsIInputStream::readSegments
60     *   (3) implement nsISeekableStream::seek
61     *
62     * History here is that we need to support both streams that already have
63     * headers (e.g., Content-Type and Content-Length) information prepended to
64     * the stream (by plugins) as well as clients (composer, uploading
65     * application) that want to upload data streams without any knowledge of
66     * protocol specifications.  For this reason, we have a special meaning
67     * for the aContentType parameter (see below).
68     * 
69     * @param aStream
70     *        The stream to be uploaded by this channel.
71     * @param aContentType
72     *        If aContentType is empty, the protocol will assume that no
73     *        content headers are to be added to the uploaded stream and that
74     *        any required headers are already encoded in the stream.  In the
75     *        case of HTTP, if this parameter is non-empty, then its value will
76     *        replace any existing Content-Type header on the HTTP request.
77     *        In the case of FTP and FILE, this parameter is ignored.
78     * @param aContentLength
79     *        A value of -1 indicates that the length of the stream should be
80     *        determined by calling the stream's |available| method.
81     */
82    void setUploadStream(in nsIInputStream aStream,
83                         in ACString aContentType,
84                         in long aContentLength);    
85
86    /**
87     * Get the stream (to be) uploaded by this channel.
88     */
89    readonly attribute nsIInputStream uploadStream;
90};