Fawkes API  Fawkes Development Version
fawkes::WebReply Class Reference

Basic web reply. More...

#include <>>

Inheritance diagram for fawkes::WebReply:

Public Types

enum  Code {
  HTTP_CONTINUE = 100, HTTP_SWITCHING_PROTOCOLS = 101, HTTP_PROCESSING = 102, HTTP_OK = 200,
  HTTP_CREATED = 201, HTTP_ACCEPTED = 202, HTTP_NON_AUTHORITATIVE_INFORMATION = 203, HTTP_NO_CONTENT = 204,
  HTTP_RESET_CONTENT = 205, HTTP_PARTIAL_CONTENT = 206, HTTP_MULTI_STATUS = 207, HTTP_MULTIPLE_CHOICES = 300,
  HTTP_MOVED_PERMANENTLY = 301, HTTP_FOUND = 302, HTTP_SEE_OTHER = 303, HTTP_NOT_MODIFIED = 304,
  HTTP_USE_PROXY = 305, HTTP_SWITCH_PROXY = 306, HTTP_TEMPORARY_REDIRECT = 307, HTTP_BAD_REQUEST = 400,
  HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404,
  HTTP_METHOD_NOT_ALLOWED = 405, HTTP_METHOD_NOT_ACCEPTABLE = 406, HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, HTTP_REQUEST_TIMEOUT = 408,
  HTTP_CONFLICT = 409, HTTP_GONE = 410, HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412,
  HTTP_REQUEST_ENTITY_TOO_LARGE = 413, HTTP_REQUEST_URI_TOO_LONG = 414, HTTP_UNSUPPORTED_MEDIA_TYPE = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
  HTTP_EXPECTATION_FAILED = 417, HTTP_UNPROCESSABLE_ENTITY = 422, HTTP_LOCKED = 423, HTTP_FAILED_DEPENDENCY = 424,
  HTTP_UNORDERED_COLLECTION = 425, HTTP_UPGRADE_REQUIRED = 426, HTTP_RETRY_WITH = 449, HTTP_INTERNAL_SERVER_ERROR = 500,
  HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, HTTP_SERVICE_UNAVAILABLE = 503, HTTP_GATEWAY_TIMEOUT = 504,
  HTTP_HTTP_VERSION_NOT_SUPPORTED = 505, HTTP_VARIANT_ALSO_NEGOTIATES = 506, HTTP_INSUFFICIENT_STORAGE = 507, HTTP_BANDWIDTH_LIMIT_EXCEEDED = 509,
  HTTP_NOT_EXTENDED = 510
}
 HTTP response code. More...
 
typedef std::map< std::string, std::string > HeaderMap
 Map of headers. More...
 

Public Member Functions

 WebReply (Code code)
 Constructor. More...
 
virtual ~WebReply ()
 Destructor. More...
 
Code code () const
 Get response code. More...
 
void add_header (std::string header, std::string content)
 Add a HTTP header. More...
 
void add_header (std::string header_string)
 Add a HTTP header. More...
 
const HeaderMapheaders () const
 get headers. More...
 
void set_request (WebRequest *request)
 Set associated request. More...
 
WebRequestget_request () const
 Get associated request. More...
 

Static Public Member Functions

static void set_caching (bool caching)
 Enable or disable caching for all consecutive replies. More...
 

Detailed Description

Basic web reply.

The base class for all web replies. Though the WebRequestDispatcher expects sub-classes of StaticWebReply or DynamicWebReply.

Author
Tim Niemueller

Definition at line 36 of file reply.h.

Member Typedef Documentation

◆ HeaderMap

typedef std::map<std::string, std::string> fawkes::WebReply::HeaderMap

Map of headers.

Definition at line 101 of file reply.h.

Member Enumeration Documentation

◆ Code

HTTP response code.

Enumerator
HTTP_CONTINUE 

CONTINUE.

HTTP_SWITCHING_PROTOCOLS 

SWITCHING_PROTOCOLS.

HTTP_PROCESSING 

PROCESSING.

HTTP_OK 

OK.

HTTP_CREATED 

CREATED.

HTTP_ACCEPTED 

ACCEPTED.

HTTP_NON_AUTHORITATIVE_INFORMATION 

NON_AUTHORITATIVE_INFORMATION.

HTTP_NO_CONTENT 

NO_CONTENT.

HTTP_RESET_CONTENT 

RESET_CONTENT.

HTTP_PARTIAL_CONTENT 

PARTIAL_CONTENT.

HTTP_MULTI_STATUS 

MULTI_STATUS.

HTTP_MULTIPLE_CHOICES 

MULTIPLE_CHOICES.

HTTP_MOVED_PERMANENTLY 

MOVED_PERMANENTLY.

HTTP_FOUND 

FOUND.

HTTP_SEE_OTHER 

SEE_OTHER.

HTTP_NOT_MODIFIED 

NOT_MODIFIED.

HTTP_USE_PROXY 

USE_PROXY.

HTTP_SWITCH_PROXY 

SWITCH_PROXY.

HTTP_TEMPORARY_REDIRECT 

TEMPORARY_REDIRECT.

HTTP_BAD_REQUEST 

BAD_REQUEST.

HTTP_UNAUTHORIZED 

UNAUTHORIZED.

HTTP_PAYMENT_REQUIRED 

PAYMENT_REQUIRED.

HTTP_FORBIDDEN 

FORBIDDEN.

HTTP_NOT_FOUND 

NOT_FOUND.

HTTP_METHOD_NOT_ALLOWED 

METHOD_NOT_ALLOWED.

HTTP_METHOD_NOT_ACCEPTABLE 

METHOD_NOT_ACCEPTABLE.

HTTP_PROXY_AUTHENTICATION_REQUIRED 

PROXY_AUTHENTICATION_REQUIRED.

HTTP_REQUEST_TIMEOUT 

REQUEST_TIMEOUT.

HTTP_CONFLICT 

CONFLICT.

HTTP_GONE 

GONE.

HTTP_LENGTH_REQUIRED 

LENGTH_REQUIRED.

HTTP_PRECONDITION_FAILED 

PRECONDITION_FAILED.

HTTP_REQUEST_ENTITY_TOO_LARGE 

REQUEST_ENTITY_TOO_LARGE.

HTTP_REQUEST_URI_TOO_LONG 

REQUEST_URI_TOO_LONG.

HTTP_UNSUPPORTED_MEDIA_TYPE 

UNSUPPORTED_MEDIA_TYPE.

HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 

REQUESTED_RANGE_NOT_SATISFIABLE.

HTTP_EXPECTATION_FAILED 

EXPECTATION_FAILED.

HTTP_UNPROCESSABLE_ENTITY 

UNPROCESSABLE_ENTITY.

HTTP_LOCKED 

LOCKED.

HTTP_FAILED_DEPENDENCY 

FAILED_DEPENDENCY.

HTTP_UNORDERED_COLLECTION 

UNORDERED_COLLECTION.

HTTP_UPGRADE_REQUIRED 

UPGRADE_REQUIRED.

HTTP_RETRY_WITH 

RETRY_WITH.

HTTP_INTERNAL_SERVER_ERROR 

INTERNAL_SERVER_ERROR.

HTTP_NOT_IMPLEMENTED 

NOT_IMPLEMENTED.

HTTP_BAD_GATEWAY 

BAD_GATEWAY.

HTTP_SERVICE_UNAVAILABLE 

SERVICE_UNAVAILABLE.

HTTP_GATEWAY_TIMEOUT 

GATEWAY_TIMEOUT.

HTTP_HTTP_VERSION_NOT_SUPPORTED 

HTTP_VERSION_NOT_SUPPORTED.

HTTP_VARIANT_ALSO_NEGOTIATES 

VARIANT_ALSO_NEGOTIATES.

HTTP_INSUFFICIENT_STORAGE 

INSUFFICIENT_STORAGE.

HTTP_BANDWIDTH_LIMIT_EXCEEDED 

BANDWIDTH_LIMIT_EXCEEDED.

HTTP_NOT_EXTENDED 

NOT_EXTENDED.

Definition at line 40 of file reply.h.

Constructor & Destructor Documentation

◆ WebReply()

fawkes::WebReply::WebReply ( Code  code)

Constructor.

Parameters
codeHTTP response code

Definition at line 50 of file reply.cpp.

References code().

◆ ~WebReply()

fawkes::WebReply::~WebReply ( )
virtual

Destructor.

Definition at line 65 of file reply.cpp.

Member Function Documentation

◆ add_header() [1/2]

void fawkes::WebReply::add_header ( std::string  header,
std::string  content 
)

◆ add_header() [2/2]

void fawkes::WebReply::add_header ( std::string  header_string)

Add a HTTP header.

Parameters
header_stringheader string of the format "Key: Value".

Definition at line 107 of file reply.cpp.

◆ code()

WebReply::Code fawkes::WebReply::code ( ) const

Get response code.

Returns
HTTP response code

Definition at line 86 of file reply.cpp.

Referenced by fawkes::dynamic_reply_free_cb(), fawkes::WebPageReply::pack(), and WebReply().

◆ get_request()

WebRequest * fawkes::WebReply::get_request ( ) const

Get associated request.

This is only valid after set_request() has been called.

Returns
associated web request

Definition at line 140 of file reply.cpp.

Referenced by fawkes::dynamic_reply_data_cb(), and fawkes::dynamic_reply_free_cb().

◆ headers()

const WebReply::HeaderMap & fawkes::WebReply::headers ( ) const

get headers.

Returns
map of header name/content pairs.

Definition at line 129 of file reply.cpp.

Referenced by fawkes::dynamic_reply_free_cb().

◆ set_caching()

void fawkes::WebReply::set_caching ( bool  caching)
static

Enable or disable caching for all consecutive replies.

This static setting controls whether following replies will allow for client-side of the web pages or not. Disabling this allows to force clients to always reload the pages.

Parameters
cachingtrue to enable client-side caching, false to disable

Definition at line 77 of file reply.cpp.

◆ set_request()

void fawkes::WebReply::set_request ( WebRequest request)

Set associated request.

Parameters
requestassociated request

Definition at line 150 of file reply.cpp.

Referenced by fawkes::dynamic_reply_free_cb().


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