70 const std::map<std::string, ConstElementPtr>& map_value = body->mapValue();
71 auto map_element = map_value.find(element_name);
72 if (map_element != map_value.end()) {
73 return (map_element->second);
77 }
catch (
const std::exception& ex) {
79 << element_name <<
": " << ex.
what());
95 }
catch (
const std::exception& ex) {
97 " request: " << ex.
what());
int version()
returns Kea hooks version.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr fromJSON(const std::string &in, bool preproc=false)
These functions will parse the given string (JSON) representation of a compound element.
void requireHeaderValue(const std::string &header_name, const std::string &header_value)
Specifies a required value of a header in the message.
void checkFinalized() const
Checks if the finalize was called.
bool created_
Flag indicating whether create was called.
virtual void reset()=0
Reset the state of the object.
bool finalized_
Flag indicating whether finalize was called.
Exception thrown when body of the HTTP message is not JSON.
HttpRequestContextPtr context_
Pointer to the HttpRequestContext holding parsed data.
virtual void create()
Commits information held in the context into the request.
const HttpRequestContextPtr & context() const
Returns pointer to the HttpRequestContext.
std::string remote_
Remote address.
virtual void finalize()
Complete parsing of the HTTP request.
data::ConstElementPtr getJsonElement(const std::string &element_name) const
Retrieves a single JSON element.
void setBodyAsJson(const data::ConstElementPtr &body)
Sets JSON body for an outbound message.
PostHttpRequestJson()
Constructor for inbound HTTP request.
data::ConstElementPtr getBodyAsJson() const
Retrieves JSON body.
virtual void reset()
Reset the state of the object.
data::ConstElementPtr json_
Pointer to the parsed JSON body.
void parseBodyAsJson()
Interprets body as JSON, which can be later retrieved using data element objects.
Represents HTTP POST request.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< BasicHttpAuth > BasicHttpAuthPtr
Type of pointers to basic HTTP authentication objects.
Defines the logger used by the top-level component of kea-lfc.