User Manual

Registering the Pages
Once you have create your file list and implemented any dynamic page handlers, you must register your page list with
the class via .addPages .
/**************************************************************************/
/*!
* @brief HTTP 404 generator. The HTTP Server will automatically redirect
* to "/404.html" when it can't find the requested url in the
* list of registered pages
*
* The url and query string are already separated when this function
* is called.
*
* @param url url of this page
* @param query query string after '?' e.g "var=value"
* @param http_request Details about this HTTP request
*/
/**************************************************************************/
void file_not_found_generator (const char* url, const char* query, httppage_request_t* http_request)
{
(void) url;
(void) query;
(void) http_request;
httpserver.print("<html><body>");
httpserver.print("<h1>Error 404 File Not Found!</h1>");
httpserver.print("<br>");
httpserver.print("Available pages are:");
httpserver.print("<br>");
// Show a link list of all available pages:
httpserver.print("<ul>");
for(int i=0; i<pagecount; i++)
{
httpserver.print("<li>");
httpserver.print(pages[i].url);
httpserver.print("</li>");
}
httpserver.print("</ul>");
httpserver.print("</body></html>");
}
You must call the .addPages function BEFORE calling the .begin function which starts the HTTP server!
.addPages can be called multiple times before .begin if you wish to organize your page list into several sets,
but be sure that the 'max_pages' value used in the constructor is big enough to accommodate all the pages.
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 103 of 202