Web server based weather station using Sparkfun Weather Meters.

Dependencies:   FatFileSystem mbed WeatherMeters SDFileSystem

Embed: (wiki syntax)

« Back to documentation index

IHTTPRequestHandler Class Reference

IHTTPRequestHandler Class Reference

The application can provide an IRequestHandler interface implementation to the HTTP server object. More...

#include <HTTPServer.h>

Inherited by CWindMeterRequestHandler.

Public Member Functions

virtual
IHTTPRequestHandlerContext
HandleGetRequest (const char *pURI)=0
 Called by the server for each GET request.
virtual
IHTTPRequestHandlerContext
HandleHeadRequest (const char *pURI)=0
 Called by the server for each HEAD request.
virtual
IHTTPRequestHandlerContext
HandlePostRequest (const char *pURI)=0
 Called by the server for each POST request.
virtual
IHTTPRequestHandlerContext
HandleBadRequest (const char *pRequest)=0
 Called by the server for each unrecognized request.

Detailed Description

The application can provide an IRequestHandler interface implementation to the HTTP server object.

The methods on such attached interface objects will be called by the server before it attempts default handling of HTTP requests. This gives the application an opportunity to provide overrides for handling POST requests or GET requests in a certain part of the URI namespace.

Definition at line 207 of file HTTPServer.h.


Member Function Documentation

virtual IHTTPRequestHandlerContext* HandleBadRequest ( const char *  pRequest ) [pure virtual]

Called by the server for each unrecognized request.

If the application would to handle such request then it should return a valid IHTTPRequestHandlerContext object pointer on which the server will call methods. These method calls will inform the application of which headers were sent in the request and then obtain the response data to be sent back to the HTTP client. Returning a NULL pointer indicates that the server should fail this bad request with an appropriate error.

Parameters:
pRequestis a pointer to the request being made by the HTTP client. This is a short lived object that will only be valid during this call.
Returns:
NULL if the CHTTPServer object should fail this request. Otherwise return an IHTTPRequestHandlerContext object pointer so that the application can be notified of additional request information and provide the response data.
virtual IHTTPRequestHandlerContext* HandleGetRequest ( const char *  pURI ) [pure virtual]

Called by the server for each GET request.

If the application would like to handle the GET request rather than using the default server code then the application should return a valid IHTTPRequestHandlerContext object pointer on which the server will call methods. These method calls will inform the application of which headers were sent in the request and then obtain the response data to be sent back to the HTTP client. Returning a NULL pointer indicates that the server should search in its pRootPathname directory for the requested file.

Parameters:
pURIis a pointer to the URI being requested by the HTTP client. This is a short lived object that will only be valid during this call.
Returns:
NULL if the CHTTPServer object should process the GET request on its own. Otherwise return an IHTTPRequestHandlerContext object pointer so that the application can be notified of additional request information and provide the response data.
virtual IHTTPRequestHandlerContext* HandleHeadRequest ( const char *  pURI ) [pure virtual]

Called by the server for each HEAD request.

If the application would like to handle the HEAD request rather than using the default server code then the application should return a valid IHTTPRequestHandlerContext object pointer on which the server will call methods. These method calls will inform the application of which headers were sent in the request and then obtain the response data to be sent back to the HTTP client. Returning a NULL pointer indicates that the server should search in its pRootPathname directory for the requested file.

Parameters:
pURIis a pointer to the URI being requested by the HTTP client. This is a short lived object that will only be valid during this call.
Returns:
NULL if the CHTTPServer object should process the HEAD request on its own. Otherwise return an IHTTPRequestHandlerContext object pointer so that the application can be notified of additional request information.
virtual IHTTPRequestHandlerContext* HandlePostRequest ( const char *  pURI ) [pure virtual]

Called by the server for each POST request.

If the application would like to handle the POST request then it should return a valid IHTTPRequestHandlerContext object pointer on which the server will call methods. These method calls will inform the application of which headers were sent in the request and then obtain the response data to be sent back to the HTTP client. Returning a NULL pointer indicates that the server should fail this POST request with a not implemented error.

Parameters:
pURIis a pointer to the URI being requested by the HTTP client. This is a short lived object that will only be valid during this call.
Returns:
NULL if the CHTTPServer object should fail the POST request. Otherwise return an IHTTPRequestHandlerContext object pointer so that the application can be notified of additional request information and provide the response data.