Public Types | Static Public Member Functions | Public Attributes | List of all members
async_web_server_cpp::HttpReply Struct Reference

#include <http_reply.hpp>

Public Types

enum  status_type {
  switching_protocols = 101, ok = 200, created = 201, accepted = 202,
  no_content = 204, multiple_choices = 300, moved_permanently = 301, moved_temporarily = 302,
  not_modified = 304, bad_request = 400, unauthorized = 401, forbidden = 403,
  not_found = 404, internal_server_error = 500, not_implemented = 501, bad_gateway = 502,
  service_unavailable = 503
}
 

Static Public Member Functions

static ReplyBuilder builder (status_type status)
 
static HttpServerRequestHandler from_file (HttpReply::status_type status, const std::string &content_type, const std::string &filename, const std::vector< HttpHeader > &additional_headers=std::vector< HttpHeader >())
 
static HttpServerRequestHandler from_filesystem (HttpReply::status_type status, const std::string &path_root, const std::string &filesystem_root, bool list_directories, const std::vector< HttpHeader > &additional_headers=std::vector< HttpHeader >())
 
static HttpServerRequestHandler static_reply (status_type status, const std::string &content_type, const std::string &content, const std::vector< HttpHeader > &additional_headers=std::vector< HttpHeader >())
 
static HttpServerRequestHandler stock_reply (status_type status)
 
static std::vector< boost::asio::const_buffer > to_buffers (const std::vector< HttpHeader > &headers)
 

Public Attributes

enum async_web_server_cpp::HttpReply::status_type status
 

Detailed Description

Utility methods for constructing replys

Definition at line 22 of file http_reply.hpp.

Member Enumeration Documentation

◆ status_type

Enumerator
switching_protocols 
ok 
created 
accepted 
no_content 
multiple_choices 
moved_permanently 
moved_temporarily 
not_modified 
bad_request 
unauthorized 
forbidden 
not_found 
internal_server_error 
not_implemented 
bad_gateway 
service_unavailable 

Definition at line 24 of file http_reply.hpp.

Member Function Documentation

◆ builder()

ReplyBuilder async_web_server_cpp::HttpReply::builder ( HttpReply::status_type  status)
static

Create a builder to create and send reply headers

Definition at line 447 of file http_reply.cpp.

◆ from_file()

HttpServerRequestHandler async_web_server_cpp::HttpReply::from_file ( HttpReply::status_type  status,
const std::string &  content_type,
const std::string &  filename,
const std::vector< HttpHeader > &  additional_headers = std::vector<HttpHeader>() 
)
static

Create a request handler that sends the contents of a file

Definition at line 237 of file http_reply.cpp.

◆ from_filesystem()

HttpServerRequestHandler async_web_server_cpp::HttpReply::from_filesystem ( HttpReply::status_type  status,
const std::string &  path_root,
const std::string &  filesystem_root,
bool  list_directories,
const std::vector< HttpHeader > &  additional_headers = std::vector<HttpHeader>() 
)
static

Create a request handler that reads files from the filesystem No content type is served and it is left to the browser to determine the content type

Parameters
path_rootthe prefix in the request path that should be ignored
filesystem_rootthe path to search for the requested file

Definition at line 314 of file http_reply.cpp.

◆ static_reply()

HttpServerRequestHandler async_web_server_cpp::HttpReply::static_reply ( HttpReply::status_type  status,
const std::string &  content_type,
const std::string &  content,
const std::vector< HttpHeader > &  additional_headers = std::vector<HttpHeader>() 
)
static

Create a request handler that sends a static response

Definition at line 416 of file http_reply.cpp.

◆ stock_reply()

HttpServerRequestHandler async_web_server_cpp::HttpReply::stock_reply ( HttpReply::status_type  status)
static

Create a request handler that sends a stock reply based on the stats code

Definition at line 410 of file http_reply.cpp.

◆ to_buffers()

std::vector< boost::asio::const_buffer > async_web_server_cpp::HttpReply::to_buffers ( const std::vector< HttpHeader > &  headers)
static

Definition at line 220 of file http_reply.cpp.

Member Data Documentation

◆ status

enum async_web_server_cpp::HttpReply::status_type async_web_server_cpp::HttpReply::status

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


async_web_server_cpp
Author(s): Mitchell Wills , Russel Toris
autogenerated on Tue Mar 1 2022 23:49:07