40#include "BESDataHandlerInterface.h"
41#include "BESResponseObject.h"
42#include "BESInternalError.h"
43#include "BESContextManager.h"
45#include "TheBESKeys.h"
50#include "BESTransmitter.h"
56bool BESTransmitter::add_method(
string method_name, p_transmitter trans_method)
58 BESTransmitter::_method_citer i;
59 i = _method_list.find(method_name);
60 if (i == _method_list.end()) {
61 _method_list[method_name] = trans_method;
67bool BESTransmitter::remove_method(
string method_name)
69 BESTransmitter::_method_iter i;
70 i = _method_list.find(method_name);
71 if (i != _method_list.end()) {
72 _method_list.erase(i);
78p_transmitter BESTransmitter::find_method(
string method_name)
80 BESTransmitter::_method_citer i;
81 i = _method_list.find(method_name);
82 if (i != _method_list.end()) {
83 p_transmitter p = (*i).second;
91 p_transmitter p = find_method(method_name);
96 throw BESInternalError(
string(
"Unable to transmit response, no transmitter for ") + method_name, __FILE__,
104 string context =
"transmit_protocol";
105 string protocol = BESContextManager::TheManager()->
get_context(context, found);
106 if (protocol ==
"HTTP") {
111 info.
print(dhi.get_output_stream());
117 string context =
"transmit_protocol";
118 string protocol = BESContextManager::TheManager()->
get_context(context, found);
119 if (protocol ==
"HTTP") {
124 info.
print(dhi.get_output_stream());
136 strm << BESIndent::LMarg <<
"BESTransmitter::dump - (" << (
void *)
this <<
")" << endl;
138 if (_method_list.size()) {
139 strm << BESIndent::LMarg <<
"registered methods:" << endl;
141 _method_citer i = _method_list.begin();
142 _method_citer ie = _method_list.end();
143 for (; i != ie; i++) {
144 strm << BESIndent::LMarg << (*i).first <<
": " << (
void *) (*i).second << endl;
146 BESIndent::UnIndent();
149 strm << BESIndent::LMarg <<
"registered methods: none" << endl;
151 BESIndent::UnIndent();
virtual std::string get_context(const std::string &name, bool &found)
retrieve the value of the specified context from the BES
Structure storing information used by the BES to handle the request.
informational response object
virtual bool is_buffered()
return whether the information is to be buffered or not.
virtual void print(std::ostream &strm)
print the information from this informational object to the specified stream
Abstract base class representing a specific set of information in response to a request to the BES.
virtual void dump(std::ostream &strm) const
dumps information about this object
static void set_mime_text(std::ostream &strm)
Generate an HTTP 1.0 response header for a text document.
static void set_mime_html(std::ostream &strm)
Generate an HTTP 1.0 response header for a html document.