HttpMultipartResource Class Reference

HttpResource that allows handling of HTTP file upload. More...

#include <HttpMultipartResource.h>

Inheritance diagram for HttpMultipartResource:
Collaboration diagram for HttpMultipartResource:

Public Member Functions

 HttpMultipartResource (const HttpFilesMapper &mapper, HttpResourceDelegate complete)
 Create and configure a HttpResource for handling file upload. More...
 
virtual int setFileMap (HttpServerConnection &connection, HttpRequest &request, HttpResponse &response)
 Callback implementation for HttpResource::onHeadersComplete. Not to be used by application code. More...
 
void shutdown (HttpServerConnection &connection) override
 Takes care to cleanup the connection. More...
 
- Public Member Functions inherited from HttpResource
virtual ~HttpResource ()
 
void addPlugin (HttpResourcePlugin *plugin)
 
template<class... Tail>
void addPlugin (HttpResourcePlugin *plugin, Tail... plugins)
 

Additional Inherited Members

- Public Attributes inherited from HttpResource
HttpResourceDelegate onUrlComplete = nullptr
 URL is ready. Path and status code are available. More...
 
HttpServerConnectionBodyDelegate onBody = nullptr
 resource wants to process the raw body data More...
 
HttpResourceDelegate onHeadersComplete = nullptr
 headers are ready More...
 
HttpResourceDelegate onRequestComplete = nullptr
 request is complete OR upgraded More...
 
HttpServerConnectionUpgradeDelegate onUpgrade = nullptr
 request is upgraded and raw data is passed to it More...
 

Detailed Description

HttpResource that allows handling of HTTP file upload.

Constructor & Destructor Documentation

◆ HttpMultipartResource()

HttpMultipartResource::HttpMultipartResource ( const HttpFilesMapper mapper,
HttpResourceDelegate  complete 
)
inline

Create and configure a HttpResource for handling file upload.

On a normal computer the file uploads are usually using temporary space on the hard disk or in memory to store the incoming data. On an embedded device that is a luxury that we can hardly afford. Therefore we should define a map that specifies explicitly where every form field will be stored. If a field is not specified then its content will be discarded.

Parameters
mappercallback that provides information where the desired upload fields will be stored.
completecallback that will be called after the request has completed.

Member Function Documentation

◆ setFileMap()

virtual int HttpMultipartResource::setFileMap ( HttpServerConnection connection,
HttpRequest request,
HttpResponse response 
)
virtual

Callback implementation for HttpResource::onHeadersComplete. Not to be used by application code.

◆ shutdown()

void HttpMultipartResource::shutdown ( HttpServerConnection connection)
overridevirtual

Takes care to cleanup the connection.

Reimplemented from HttpResource.


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