Struct HttpReply

Struct Documentation

struct async_web_server_cpp::HttpReply

Utility methods for constructing replys

Public Types

enum status_type

Values:

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

Public Members

enum async_web_server_cpp::HttpReply::status_type status

Public Static Functions

static std::vector<boost::asio::const_buffer> to_buffers(const std::vector<HttpHeader> &headers)
static HttpServerRequestHandler stock_reply(status_type status)

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

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>())

Create a request handler that sends the contents of a file

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>())

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_root – the prefix in the request path that should be ignored

  • filesystem_root – the path to search for the requested file

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>())

Create a request handler that sends a static response

static ReplyBuilder builder(status_type status)

Create a builder to create and send reply headers