16 PostHttpRequestJson::PostHttpRequestJson()
68 const std::map<std::string, ConstElementPtr>& map_value = body->mapValue();
69 auto map_element = map_value.find(element_name);
70 if (map_element != map_value.end()) {
71 return (map_element->second);
75 }
catch (
const std::exception& ex) {
77 << element_name <<
": " << ex.
what());
89 }
catch (
const std::exception& ex) {
91 " request: " << ex.
what());
data::ConstElementPtr getJsonElement(const std::string &element_name) const
Retrieves a single JSON element.
bool finalized_
Flag indicating whether finalize was called.
virtual void finalize()
Complete parsing of the HTTP request.
HttpRequestContextPtr context_
Pointer to the HttpRequestContext holding parsed data.
Represents HTTP POST request.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
data::ConstElementPtr getBodyAsJson() const
Retrieves JSON body.
Exception thrown when body of the HTTP message is not JSON.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
bool created_
Flag indicating whether create was called.
const HttpRequestContextPtr & context() const
Returns pointer to the HttpRequestContext.
virtual void reset()
Reset the state of the object.
PostHttpRequestJson()
Constructor for inbound HTTP request.
boost::shared_ptr< const Element > ConstElementPtr
void checkFinalized() const
Checks if the finalize was called.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void setBodyAsJson(const data::ConstElementPtr &body)
Sets JSON body for an outbound message.
data::ConstElementPtr json_
Pointer to the parsed JSON body.
virtual void create()
Commits information held in the context into the request.
int version()
returns Kea hooks version.
void parseBodyAsJson()
Interprets body as JSON, which can be later retrieved using data element objects.
void requireHeaderValue(const std::string &header_name, const std::string &header_value)
Specifies a required value of a header in the message.
virtual void reset()
Reset the state of the object.