HttpResourceTree Class Reference

Class to map URL paths to classes which handle them. More...

#include <HttpResourceTree.h>

Inheritance diagram for HttpResourceTree:
Collaboration diagram for HttpResourceTree:

Public Member Functions

HttpResourcesetDefault (HttpResource *resource)
 Set the default resource handler. More...
 
HttpResourcesetDefault (const HttpResourceDelegate &onRequestComplete)
 Set the default resource handler, identified by "*" wildcard. More...
 
HttpResourcesetDefault (const HttpPathDelegate &callback)
 Set the default resource handler, identified by "*" wildcard. More...
 
HttpResourcegetDefault ()
 Get the current default resource handler, if any. More...
 
template<class... Tail>
HttpResourceset (const String &path, HttpResource *resource, HttpResourcePlugin *plugin, Tail... plugins)
 
HttpResourceset (const String &path, const HttpResourceDelegate &onRequestComplete)
 Set a callback to handle the given path. More...
 
template<class... Tail>
HttpResourceset (const String &path, const HttpResourceDelegate &onRequestComplete, HttpResourcePlugin *plugin, Tail... plugins)
 Set a callback to handle the given path, with one or more plugins. More...
 
HttpResourceset (String path, const HttpPathDelegate &callback)
 Add a new path resource with a callback. More...
 
template<class... Tail>
HttpResourceset (const String &path, const HttpPathDelegate &callback, HttpResourcePlugin *plugin, Tail... plugins)
 Add a new path resource with callback and one or more plugins. More...
 
void set (const K &key, V *value)
 Set a key value. More...
 
- Public Member Functions inherited from ObjectMap< String, HttpResource >
 ObjectMap ()
 
 ~ObjectMap ()
 
unsigned count () const
 Get the number of entries in this map. More...
 
const StringkeyAt (unsigned idx) const
 
StringkeyAt (unsigned idx)
 
const HttpResourcevalueAt (unsigned idx) const
 
Value valueAt (unsigned idx)
 
const HttpResourceoperator[] (const String &key) const
 Get value for given key, if it exists. More...
 
Value operator[] (const String &key)
 Access map entry by reference. More...
 
Value get (const String &key)
 Get map entry value. More...
 
void set (const String &key, HttpResource *value)
 Set a key value. More...
 
HttpResourcefind (const String &key) const
 Find the value for a given key, if it exists. More...
 
int indexOf (const String &key) const
 Get the index of a key. More...
 
bool contains (const String &key) const
 Check if a key is contained within this map. More...
 
void removeAt (unsigned index)
 Remove entry at given index. More...
 
bool remove (const String &key)
 Remove a key from this map. More...
 
HttpResourceextract (const String &key)
 Get the value for a given key and remove it from the map, without destroying it. More...
 
HttpResourceextractAt (unsigned index)
 Get the value at a given index and remove it from the map, without destroying it. More...
 
void clear ()
 Clear the map of all entries. More...
 

Additional Inherited Members

- Protected Attributes inherited from ObjectMap< String, HttpResource >
Vector< Entry > entries
 

Detailed Description

Class to map URL paths to classes which handle them.

Member Function Documentation

◆ getDefault()

HttpResource* HttpResourceTree::getDefault ( )
inline

Get the current default resource handler, if any.

Return values
HttpResource*

◆ set() [1/6]

void ObjectMap< K, V >::set
inline

Set a key value.

Parameters
key
value

◆ set() [2/6]

template<class... Tail>
HttpResource* HttpResourceTree::set ( const String path,
const HttpPathDelegate callback,
HttpResourcePlugin plugin,
Tail...  plugins 
)
inline

Add a new path resource with callback and one or more plugins.

Parameters
pathURL path
callbackThe callback that will handle this path
plugin- optional resource plugin
Return values
HttpResource*The created resource object
Note
Path should start with slash. Trailing slashes will be removed
Any existing handler for this path is replaced

◆ set() [3/6]

HttpResource* HttpResourceTree::set ( const String path,
const HttpResourceDelegate onRequestComplete 
)

Set a callback to handle the given path.

Parameters
pathURL path
onRequestCompleteDelegate to handle this path
Return values
HttpResource*The created resource object
Note
Path should start with slash. Trailing slashes will be removed.
Any existing handler for this path is replaced

◆ set() [4/6]

template<class... Tail>
HttpResource* HttpResourceTree::set ( const String path,
const HttpResourceDelegate onRequestComplete,
HttpResourcePlugin plugin,
Tail...  plugins 
)
inline

Set a callback to handle the given path, with one or more plugins.

Parameters
pathURL path
onRequestCompleteDelegate to handle this path
pluginPlugins to register for the resource
Return values
HttpResource*The created resource object
Note
Path should start with slash. Trailing slashes will be removed.
Any existing handler for this path is replaced

◆ set() [5/6]

template<class... Tail>
HttpResource* HttpResourceTree::set ( const String path,
HttpResource resource,
HttpResourcePlugin plugin,
Tail...  plugins 
)
inline

◆ set() [6/6]

HttpResource* HttpResourceTree::set ( String  path,
const HttpPathDelegate callback 
)

Add a new path resource with a callback.

Parameters
pathURL path
callbackThe callback that will handle this path
Note
Path should start with slash. Trailing slashes will be removed
Any existing handler for this path is replaced

◆ setDefault() [1/3]

HttpResource* HttpResourceTree::setDefault ( const HttpPathDelegate callback)
inline

Set the default resource handler, identified by "*" wildcard.

◆ setDefault() [2/3]

HttpResource* HttpResourceTree::setDefault ( const HttpResourceDelegate onRequestComplete)
inline

Set the default resource handler, identified by "*" wildcard.

Parameters
onRequestCompleteThe default resource handler

◆ setDefault() [3/3]

HttpResource* HttpResourceTree::setDefault ( HttpResource resource)
inline

Set the default resource handler.

Parameters
resourceThe default resource handler

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