My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

Embed: (wiki syntax)

« Back to documentation index

HTTPHandler Class Reference

HTTPHandler Class Reference

A HTTPHandler will serve the requested data if there is an object of a child class from HTTPHandler which is registert to an matching prefix. More...

#include <HTTPServer.h>

Protected Member Functions

virtual void reg (HTTPServer *)
 Register needed header fields by the HTTPServer.
virtual HTTPHandle action (HTTPConnection *) const
 This Method returns if you will deliver the requested page or not.
virtual HTTPStatus init (HTTPConnection *) const
 If action returned HTTP_Deliver.
virtual HTTPHandle data (HTTPConnection *, void *data, int len) const
 If data from a post request is arrived for an request you accepted this function will be executed with the data.
virtual HTTPHandle send (HTTPConnection *, int) const
 If tere is new space in the sendbuffer this function is executed.
const char * getPrefix () const
 returns the Prefix from the HTTPHandler

Detailed Description

A HTTPHandler will serve the requested data if there is an object of a child class from HTTPHandler which is registert to an matching prefix.

To see how to implement your own HTTPHandler classes have a look at HTTPRPC HTTPStaticPage and HTTPFileSystemHandler.

Definition at line 86 of file HTTPServer.h.


Member Function Documentation

virtual HTTPHandle action ( HTTPConnection  ) const [protected, virtual]

This Method returns if you will deliver the requested page or not.

It will only executed if the prefix is matched by the URL. If you want to add something to the headerfiles use this method and return HTTP_AddFields. See HTTPFields This would be the right method to implement an Auth Handler.

Definition at line 107 of file HTTPServer.h.

virtual HTTPHandle data ( HTTPConnection ,
void *  data,
int  len 
) const [protected, virtual]

If data from a post request is arrived for an request you accepted this function will be executed with the data.

Parameters:
dataA pointer to the received data.
lenThe length of the received data.
Returns:
Return an HTTPHandle. For example HTTP_SuccessEnded if you received all your needed data and want to close the conection (normally not the case).

Definition at line 122 of file HTTPServer.h.

const char* getPrefix (  ) const [protected]

returns the Prefix from the HTTPHandler

Definition at line 133 of file HTTPServer.h.

virtual HTTPStatus init ( HTTPConnection  ) const [protected, virtual]

If action returned HTTP_Deliver.

This function will be executed and it means your handler will be deliver the requested data. In this method is the right place to allocate the needed space for your request data and to prepare the sended Header.

Definition at line 114 of file HTTPServer.h.

virtual void reg ( HTTPServer  ) [protected, virtual]

Register needed header fields by the HTTPServer.

Because of memory size the server will throw away all request header fields which are not registert. Register the fields you need in your implementation of this method.

Definition at line 99 of file HTTPServer.h.

virtual HTTPHandle send ( HTTPConnection ,
int   
) const [protected, virtual]

If tere is new space in the sendbuffer this function is executed.

You can send maximal Bytes of data.

Returns:
Return an HTTPHandle. For example HTTP_SuccessEnded if you send out all your data and you want to close the connection.

Definition at line 128 of file HTTPServer.h.