pjs/netwerk/base/public/nsIURIChecker.idl

97 строки
4.0 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Akkana Peck <akkana@netscape.com> (original author)
* Darin Fisher <darin@meer.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIRequest.idl"
interface nsIURI;
interface nsIChannel;
interface nsIRequestObserver;
/**
* nsIURIChecker
*
* The URI checker is a component that can be used to verify the existance
* of a resource at the location specified by a given URI. It will use
* protocol specific methods to verify the URI (e.g., use of HEAD request
* for HTTP URIs).
*/
[scriptable, uuid(4660c1a1-be2d-4c78-9baf-c22984176c28)]
interface nsIURIChecker : nsIRequest
{
/**
* Initializes the URI checker. After this method is called, it is valid
* to further configure the URI checker by calling its nsIRequest methods.
* This method creates the channel that will be used to verify the URI.
* In the case of the HTTP protocol, only a HEAD request will be issued.
*
* @param aURI
* The URI to be checked.
*/
void init(in nsIURI aURI);
/**
* Returns the base channel that will be used to verify the URI.
*/
readonly attribute nsIChannel baseChannel;
/**
* Begin asynchronous checking URI for validity. Notification will be
* asynchronous through the nsIRequestObserver callback interface. When
* OnStartRequest is fired, the baseChannel attribute will have been
* updated to reflect the final channel used (corresponding to any redirects
* that may have been followed).
*
* Our interpretations of the nsIRequestObserver status codes:
* NS_BINDING_SUCCEEDED: link is valid
* NS_BINDING_FAILED: link is invalid (gave an error)
* NS_BINDING_ABORTED: timed out, or cancelled
*
* @param aObserver
* The object to notify when the link is verified. We will
* call aObserver.OnStartRequest followed immediately by
* aObserver.OnStopRequest. It is recommended that the caller use
* OnStopRequest to act on the link's status. The underlying request
* will not be cancelled until after OnStopRequest has been called.
* @param aContext
* A closure that will be passed back to the nsIRequestObserver
* methods.
*/
void asyncCheck(in nsIRequestObserver aObserver, in nsISupports aContext);
};