nsIHttpRequestHandler Interface Reference


Inheritance diagram for nsIHttpRequestHandler:
Collaboration diagram for nsIHttpRequestHandler:

Public Member Functions

void handle (in nsIHttpRequestMetadata metadata, in nsIHttpResponse response)

Detailed Description

A representation of a handler for HTTP requests. The handler is used by calling its .handle method with data for an incoming request; it is the handler's job to use that data as it sees fit to make the desired response.

This interface uses the [function] attribute, so you can pass a script-defined function with the functionality of handle() to any method which has a nsIHttpRequestHandler parameter, instead of wrapping it in an otherwise empty object.

Definition at line 380 of file nsIHttpServer.idl.

Member Function Documentation

void nsIHttpRequestHandler::handle ( in nsIHttpRequestMetadata  metadata,
in nsIHttpResponse  response 

Processes the HTTP request represented by metadata and initializes the passed-in response to reflect the correct HTTP response.

If this method throws an exception, externally observable behavior depends upon whether is being processed asynchronously and the connection has had any data written to it (even an explicit zero bytes of data being written) or whether seizePower() has been called on it. If such has happened, sent data will be exactly that data written at the time the exception was thrown. If no data has been written, the response has not had seizePower() called on it, and it is not being asynchronously created, an error handler will be invoked (usually 500 unless otherwise specified). Note that some uses of nsIHttpRequestHandler may require this method to never throw an exception; in the general case, however, this method may throw an exception (causing an HTTP 500 response to occur).

metadatadata representing an HTTP request
responsean initially-empty response which must be modified to reflect the data which should be sent as the response to the request described by metadata

The documentation for this interface was generated from the following file: