|
mod_servlet
C++Servlets
|
This class represents a multipart input stream of a multipart/form-data request body.
More...
#include <request.h>
Public Member Functions | |
| virtual const std::map < std::string, std::vector < std::string >, std::less<> > & | get_headers () const =0 |
| Obtain all the headers of the curent part. More... | |
| template<typename StringType > | |
| optional_ref< const std::string > | get_header (const StringType &name) const |
Obtains the value of the specified part header as a reference to a std::string. More... | |
| template<typename StringType > | |
| optional_ref< const std::vector< std::string > > | get_headers (const StringType &name) const |
| Obtain all the values of the specified part header. More... | |
| optional_ref< const std::string > | get_content_type () const |
| Obtain the content type passed by the browser. More... | |
| optional_ref< const std::string > | get_name () const |
| Obtain the name of the field in the multipart form corresponding to this part. More... | |
| optional_ref< const std::string > | get_submitted_filename () const |
| If this part represents an uploaded file, gets the file name submitted in the upload. More... | |
| virtual std::istream & | get_input_stream ()=0 |
Obtain an std::itream that can be used to retrieve the contents of the current part. More... | |
| virtual bool | to_next_part ()=0 |
| Moves this multipart_input to the next part. More... | |
This class represents a multipart input stream of a multipart/form-data request body.
Each part of this class may represent either an uploaded file or form data.
This class is built on top of input stream of a request and it doesn't cache any data.
The parts can be navigated only in forward direction using to_next_part method. The usual use of this class can be illustrated by the following code:
|
inline |
Obtain the content type passed by the browser.
null if not defined.
|
inline |
Obtains the value of the specified part header as a reference to a std::string.
If there are multiple headers with the same name, this method returns the first header in the part.
| StringType | a type comparable to std::string |
| name | Header name |
|
pure virtual |
Obtain all the headers of the curent part.
|
inline |
Obtain all the values of the specified part header.
| StringType | a type comparable to std::string |
| name | The name of the header of interest. |
std::vector.
|
pure virtual |
Obtain an std::itream that can be used to retrieve the contents of the current part.
|
inline |
Obtain the name of the field in the multipart form corresponding to this part.
| optional_ref<const std::string> servlet::multipart_input::get_submitted_filename | ( | ) | const |
If this part represents an uploaded file, gets the file name submitted in the upload.
Returns empty reference if no file name is available or if this part is not a file upload.
|
pure virtual |
Moves this multipart_input to the next part.
true if the next part exists and readable, otherwise false