NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::http::IFactory Class Referenceabstract

The factory can be used to instantiate the built-in HTTP classes. More...

Inheritance diagram for mi::http::IFactory:
Inheritance graph
[legend]

Public Member Functions

virtual IServer create_server ()=0
  Creates a new HTTP server. More...
 
virtual IRequest_handler create_file_handler (const char *root_url, const char *root_path, bool is_recursive=true)=0
  Creates a new file handler for the server. More...
 
virtual IRequest_handler create_redirect_handler (const char *source_url, const char *target_url)=0
  Creates a new redirect handler which will redirect requests to a certain URL to a new URL. More...
 
virtual IResponse_handler create_log_handler (const char *path)=0
  Creates a new log handler. More...
 
virtual IResponse_handler create_chunked_encoding_handler ()=0
  Creates a new chunked encoding handler. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xddded154, 0x4be8, 0x42b6, 0x81, 0x68, 0x21, 0x16, 0xc7, 0xbd, 0x63, 0x40 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xddded154, 0x4be8, 0x42b6, 0x81, 0x68, 0x21, 0x16, 0xc7, 0xbd, 0x63, 0x40 >
static bool  compare_iid (const Uuid &iid)
  Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

The factory can be used to instantiate the built-in HTTP classes.

In addition to the HTTP server it can create a number of built-in request and response handlers. Those handlers need to be installed with one or more servers using the server's install() methods. Unless indicated otherwise a handler obtained from the factory function can be installed to multiple HTTP servers.

Member Function Documentation

virtual IResponse_handler* mi::http::IFactory::create_chunked_encoding_handler ( )
pure virtual

Creates a new chunked encoding handler.

If installed on a server it will allow to keep connections alive even if the size of the generated content is not know in advance. This is done by installing a data handler on a connection if the response does not contain the data size when it is sent. The response handler will modify the response and then modify all data passed to the client to be sent in chunks. This handler needs to be installed as the last response handler to work correctly. Exempt from this are response handlers which do not change the data on the way to its clients, e.g., the log handler.

The handler needs to be installed with the desired server using mi::http::IServer::install(IResponse_handler*).

virtual IRequest_handler* mi::http::IFactory::create_file_handler ( const char *  root_url,
const char *  root_path,
bool  is_recursive = true 
)
pure virtual

Creates a new file handler for the server.

The handler will map a given file or directory into the URL namespace at the root_url.

The handler needs to be installed with the desired server using mi::http::IServer::install(IRequest_handler*).

Parameters
root_url The URL needs to start with this prefix to be served by the handler.
root_path When a matching URL is found root_url is replaced by this argument to get the path of a file to be served. If this file can be opened for reading, it will be sent to the client.
is_recursive Indicates whether handler serves only a single file or a directory tree.
Returns
The new request handler.
virtual IResponse_handler* mi::http::IFactory::create_log_handler ( const char *  path)
pure virtual

Creates a new log handler.

This handler will write a request log to a file with a given path. The file format of the log file is the so called 'Combined log format' used by various HTTP servers.

The handler needs to be installed with the desired server using mi::http::IServer::install(IResponse_handler*).

Parameters
path Path of the log file to be written.
virtual IRequest_handler* mi::http::IFactory::create_redirect_handler ( const char *  source_url,
const char *  target_url 
)
pure virtual

Creates a new redirect handler which will redirect requests to a certain URL to a new URL.

The handler needs to be installed with the desired server using mi::http::IServer::install(IRequest_handler*).

Parameters
source_url If this URL is found it is redirected to the target_url.
target_url Target of the redirection.
virtual IServer* mi::http::IFactory::create_server ( )
pure virtual

Creates a new HTTP server.