|
| template<typename T> |
| | operator T () const |
| | This template enables implicit type conversion. For using this template, user must specialize the fromRequest template. For example a shared_ptr<Json::Value> specialization version is available above, so we can use the following code to get a json object:
|
|
template<typename T> |
| T | as () const |
| | This template enables explicit type conversion, see the above template.
|
|
virtual const char * | methodString () const =0 |
| | Return the method string of the request, such as GET, POST, etc.
|
|
const char * | getMethodString () const |
|
virtual HttpMethod | method () const =0 |
| | Return the enum type method of the request.
|
|
HttpMethod | getMethod () const |
| virtual bool | isHead () const =0 |
| | Check if the method is or was HttpMethod::Head.
|
| virtual const std::string & | getHeader (std::string key) const =0 |
| | Get the header string identified by the key parameter.
|
| virtual void | addHeader (std::string field, const std::string &value)=0 |
| | Set the header string identified by the field parameter.
|
|
virtual void | addHeader (std::string field, std::string &&value)=0 |
| virtual void | removeHeader (std::string key)=0 |
| | Remove the header identified by the key parameter.
|
|
virtual void | clearHeaders ()=0 |
|
virtual const std::string & | getCookie (const std::string &field) const =0 |
| | Get the cookie string identified by the field parameter.
|
|
virtual const SafeStringMap< std::string > & | headers () const =0 |
| | Get all headers of the request.
|
|
const SafeStringMap< std::string > & | getHeaders () const |
| | Get all headers of the request.
|
|
virtual const SafeStringMap< std::string > & | cookies () const =0 |
| | Get all cookies of the request.
|
|
const SafeStringMap< std::string > & | getCookies () const |
| | Get all cookies of the request.
|
|
virtual size_t | realContentLength () const =0 |
| | Return content length parsed from the Content-Length header If no Content-Length header, return null.
|
|
size_t | getRealContentLength () const |
| virtual const std::string & | query () const =0 |
| | Get the query string of the request.
|
|
const std::string & | getQuery () const |
| | Get the query string of the request.
|
| std::string_view | body () const |
| std::string_view | getBody () const |
|
virtual const char * | bodyData () const =0 |
|
virtual size_t | bodyLength () const =0 |
|
virtual void | setBody (const std::string &body)=0 |
| | Set the content string of the request.
|
|
virtual void | setBody (std::string &&body)=0 |
| | Set the content string of the request.
|
|
virtual const std::string & | path () const =0 |
| | Get the path of the request.
|
|
virtual const std::string & | getOriginalPath () const =0 |
| | Get the original path of the request.(before url-decoding).
|
|
const std::string & | getPath () const |
| | Get the path of the request.
|
|
std::string_view | getMatchedPathPattern () const |
| | Get the matched path pattern after routing.
|
|
std::string_view | matchedPathPattern () const |
| | Get the matched path pattern after routing.
|
| virtual const std::vector< std::string > & | getRoutingParameters () const =0 |
|
virtual void | setRoutingParameters (std::vector< std::string > &¶ms)=0 |
| | This method usually is called by the framework.
|
|
virtual const char * | matchedPathPatternData () const =0 |
|
virtual size_t | matchedPathPatternLength () const =0 |
| virtual const char * | versionString () const =0 |
|
const char * | getVersionString () const |
| virtual Version | version () const =0 |
| | Return the enum type version of the request.
|
|
Version | getVersion () const |
| | Return the enum type version of the request.
|
|
virtual const SessionPtr & | session () const =0 |
| | Get the session to which the request belongs.
|
|
const SessionPtr & | getSession () const |
| | Get the session to which the request belongs.
|
| virtual const AttributesPtr & | attributes () const =0 |
| const AttributesPtr & | getAttributes () const |
|
virtual const SafeStringMap< std::string > & | parameters () const =0 |
| | Get parameters of the request.
|
|
const SafeStringMap< std::string > & | getParameters () const |
| | Get parameters of the request.
|
| virtual const std::string & | getParameter (const std::string &key) const =0 |
| | Get a parameter identified by the.
|
| template<typename T> |
| std::optional< T > | getOptionalParameter (const std::string &key) |
| | Get the optional parameter identified by the key. if the parameter doesn't exist, or the original parameter can't be converted to a T type object, an empty optional object is returned.
|
|
virtual const trantor::InetAddress & | peerAddr () const =0 |
| | Return the remote IP address and port.
|
|
const trantor::InetAddress & | getPeerAddr () const |
|
virtual const trantor::InetAddress & | localAddr () const =0 |
| | Return the local IP address and port.
|
|
const trantor::InetAddress & | getLocalAddr () const |
|
virtual const trantor::Date & | creationDate () const =0 |
| | Return the creation timestamp set by the framework.
|
|
const trantor::Date & | getCreationDate () const |
|
virtual const trantor::CertificatePtr & | peerCertificate () const =0 |
|
const trantor::CertificatePtr & | getPeerCertificate () const |
| virtual const std::shared_ptr< Json::Value > & | jsonObject () const =0 |
| | Get the Json object of the request.
|
|
const std::shared_ptr< Json::Value > & | getJsonObject () const |
| | Get the Json object of the request.
|
| virtual const std::string & | getJsonError () const =0 |
| | Get the error message of parsing the JSON body received from peer. This method usually is called after getting a empty shared_ptr object by the getJsonObject() method.
|
|
virtual ContentType | contentType () const =0 |
| | Get the content type.
|
|
ContentType | getContentType () const |
|
virtual void | setMethod (const HttpMethod method)=0 |
| | Set the Http method.
|
| virtual void | setPath (const std::string &path)=0 |
|
virtual void | setPath (std::string &&path)=0 |
| virtual void | setPathEncode (bool)=0 |
| | The default behavior is to encode the value of setPath using urlEncode. Setting the path encode to false avoid the value of path will be changed by the library.
|
|
virtual void | setParameter (const std::string &key, const std::string &value)=0 |
| | Set the parameter of the request.
|
| virtual void | setQueryParameter (const std::string &key, const std::string &value)=0 |
| virtual void | setBodyParameter (const std::string &key, const std::string &value)=0 |
|
virtual void | setContentTypeCode (const ContentType type)=0 |
| | Set or get the content type.
|
| void | setContentTypeString (const std::string_view &typeString) |
| | For example, "content-type: text/plain\r\n" or "text/plain".
|
| virtual void | setCustomContentTypeString (const std::string &type)=0 |
|
virtual void | addCookie (std::string key, std::string value)=0 |
| | Add a cookie.
|
| virtual void | setPassThrough (bool flag)=0 |
| | Set the request object to the pass-through mode or not. It's not by default when a new request object is created. In pass-through mode, no additional headers (including user-agent, connection, etc.) are added to the request. This mode is useful for some applications such as a proxy.
|
| bool | isCorsRequest () const |
| | Check if the request is a CORS request.
|
| bool | isCorsPreflightRequest () const |
| | Check if the request is a CORS pre-flight request.
|
|
virtual bool | isOnSecureConnection () const noexcept=0 |
|
virtual void | setContentTypeString (const char *typeString, size_t typeStringLength)=0 |
|
virtual bool | connected () const noexcept=0 |
|
virtual const std::weak_ptr< trantor::TcpConnection > & | getConnectionPtr () const noexcept=0 |
Abstract class for webapp developer to get or set the Http request;.