Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Stroika::Frameworks::WebServer::Request Class Reference

this represents a HTTP request object for the WebServer module More...

#include <Request.h>

Inheritance diagram for Stroika::Frameworks::WebServer::Request:
Stroika::Foundation::IO::Network::HTTP::Request

Public Member Functions

nonvirtual Memory::BLOB GetBody ()
 
nonvirtual DataExchange::VariantValue GetBodyVariantValue ()
 
nonvirtual Streams::InputStream::Ptr< byte > GetInputStream ()
 
nonvirtual Streams::InputStream::Ptr< byte > GetBodyStream ()
 
nonvirtual String ToString () const
 
- Public Member Functions inherited from Stroika::Foundation::IO::Network::HTTP::Request
nonvirtual String ToString () const
 

Public Attributes

Common::ReadOnlyProperty< bool > keepAliveRequested
 mostly looks at Connection: ARG header, but if not there takes into account HTTP-version specific defaults.
 
- Public Attributes inherited from Stroika::Foundation::IO::Network::HTTP::Request
Common::Property< StringhttpVersion
 
Common::Property< StringhttpMethod
 typically HTTP::Methods::kGet
 
Common::Property< URIurl
 
Common::ReadOnlyProperty< const Headers & > headers
 
Common::Property< Headers & > rwHeaders
 
Common::ReadOnlyProperty< optional< InternetMediaType > > contentType
 

Detailed Description

this represents a HTTP request object for the WebServer module

Note
Satisfies Concepts: o static_assert (not copyable<Request>); o static_assert (movable<Request>);

TODO:

Note
Thread-Safety C++-Standard-Thread-Safety

Definition at line 44 of file Frameworks/WebServer/Request.h.

Member Function Documentation

◆ GetBody()

Memory::BLOB Request::GetBody ( )

Quicky impl. Need to improve this significantly. Can call multiple times - but first time it blocks fetching data

Definition at line 65 of file Frameworks/WebServer/Request.cpp.

◆ GetBodyVariantValue()

DataExchange::VariantValue Request::GetBodyVariantValue ( )

Check the content-type of the argument (with InternetMediaTypesRegistry::IsA - so matches sub-types) and select the appropriate parser to return the body as a VariantValue.

Note
- this will block (calls GetBody()); and will throw if conversion problem/wrong contentType.
Supported InternetMediaTypes for message body content type: o IsA (InternetMediaTypes::kJSON) (uses Variant::JSON::Reader to interpret the content)
if content type is missing, an empty VariantValue will be returned.

Definition at line 77 of file Frameworks/WebServer/Request.cpp.

◆ GetInputStream()

Streams::InputStream::Ptr< byte > Stroika::Frameworks::WebServer::Request::GetInputStream ( )

Definition at line 25 of file Frameworks/WebServer/Request.inl.

◆ GetBodyStream()

Streams::InputStream::Ptr< byte > Request::GetBodyStream ( )

This returns a (generally unseekable) stream of bytes. In most cases, this stream will be artificially narrowed to just the body part of the request. When a Content-Length is known, that is used to limit the stream. When a Transfer-Coding is used, that will return the apparent (decoded) bytes (NYI).

Precondition
This may ONLY be called after the headers have been set (read) – TODO DOCUMENT HOW THIS CAN BE CHECKED AND VERIFIED - I THINK ANSWER RESIDES IN CONNECTION OBJECT

Definition at line 91 of file Frameworks/WebServer/Request.cpp.

◆ ToString()

String Request::ToString ( ) const
See also
Characters::ToString ()

Definition at line 126 of file Frameworks/WebServer/Request.cpp.


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