represents an xml formatted response object More...
#include <BESXMLInfo.h>
Public Member Functions | |
virtual void | add_break (unsigned long num_breaks) |
add a line break to the information | |
virtual void | add_data (const string &s) |
add data to this informational object. | |
virtual void | add_data_from_file (const string &key, const string &name) |
add data from a file to the informational object | |
virtual void | add_exception (BESError &e, const string &admin) |
add exception information to this informational object | |
virtual void | add_space (unsigned long num_spaces) |
add a space to the informational response | |
virtual void | add_tag (const string &tag_name, const string &tag_data, map< string, string > *attrs=0) |
add tagged information to the inforamtional response | |
virtual void | begin_response (const string &response_name, BESDataHandlerInterface &dhi) |
begin the informational response | |
virtual void | begin_tag (const string &tag_name, map< string, string > *attrs=0) |
begin a tagged part of the information, information to follow | |
BESXMLInfo () | |
constructs an informational response object as an xml document | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
virtual void | end_response () |
end the response | |
virtual void | end_tag (const string &tag_name) |
end a tagged part of the informational response | |
virtual bool | is_buffered () |
return whether the information is to be buffered or not. | |
virtual void | print (ostream &strm) |
print the information from this informational object to the specified stream | |
virtual void | transmit (BESTransmitter *transmitter, BESDataHandlerInterface &dhi) |
transmit the text information as text | |
virtual | ~BESXMLInfo () |
Static Public Member Functions | |
static BESInfo * | BuildXMLInfo (const string &info_type) |
Protected Member Functions | |
virtual void | begin_tag (const string &tag_name, const string &ns, const string &uri, map< string, string > *attrs=0) |
begin a tagged part of the information, information to follow | |
Protected Attributes | |
bool | _buffered |
string | _response_name |
bool | _response_started |
ostream * | _strm |
bool | _strm_owned |
stack< string > | _tags |
represents an xml formatted response object
An informational response object that is formated as an XML document.
Definition at line 48 of file BESXMLInfo.h.
BESXMLInfo::BESXMLInfo | ( | ) |
constructs an informational response object as an xml document
Definition at line 53 of file BESXMLInfo.cc.
Referenced by BuildXMLInfo().
BESXMLInfo::~BESXMLInfo | ( | ) | [virtual] |
Definition at line 62 of file BESXMLInfo.cc.
void BESXMLInfo::add_break | ( | unsigned long | num_breaks | ) | [virtual] |
add a line break to the information
num_breaks | the number of line breaks to add to the information |
Implements BESInfo.
Definition at line 462 of file BESXMLInfo.cc.
References add_data().
void BESXMLInfo::add_data | ( | const string & | s | ) | [virtual] |
add data to this informational object.
If buffering is not set then the information is output directly to the output stream.
s | information to be added to this informational response object |
Reimplemented from BESInfo.
Definition at line 473 of file BESXMLInfo.cc.
Referenced by add_break(), and add_space().
void BESXMLInfo::add_data_from_file | ( | const string & | key, | |
const string & | name | |||
) | [virtual] |
add data from a file to the informational object
This method simply adds a .XML to the end of the key and passes the request on up to the BESInfo parent class.
key | Key from the initialization file specifying the file to be | |
name | A description of what is the information being loaded |
Reimplemented from BESInfo.
Definition at line 487 of file BESXMLInfo.cc.
References begin_tag(), and end_tag().
void BESInfo::add_exception | ( | BESError & | e, | |
const string & | administrator | |||
) | [virtual, inherited] |
add exception information to this informational object
Exception information is added differently to different informational objects, such as html, xml, plain text. But, using the other methods of this class we can take care of exceptions here.
e | The exception to add to the informational response object |
Reimplemented in BESDapErrorInfo, BESSilentInfo, and BESVersionInfo.
Definition at line 242 of file BESInfo.cc.
References BESInfo::add_tag(), BESInfo::begin_tag(), BESInfo::end_tag(), BESError::get_error_type(), BESError::get_file(), BESError::get_line(), and BESError::get_message().
Referenced by BESVersionInfo::add_exception(), and BESExceptionManager::handle_exception().
void BESXMLInfo::add_space | ( | unsigned long | num_spaces | ) | [virtual] |
add a space to the informational response
num_spaces | the number of spaces to add to the information |
Implements BESInfo.
Definition at line 447 of file BESXMLInfo.cc.
References add_data().
void BESXMLInfo::add_tag | ( | const string & | tag_name, | |
const string & | tag_data, | |||
map< string, string > * | attrs = 0 | |||
) | [virtual] |
add tagged information to the inforamtional response
tag_name | name of the tag to be added to the response | |
tag_data | information describing the tag | |
attrs | map of attributes to add to the tag |
Implements BESInfo.
Definition at line 261 of file BESXMLInfo.cc.
References BESInfo::_response_name.
void BESXMLInfo::begin_response | ( | const string & | response_name, | |
BESDataHandlerInterface & | dhi | |||
) | [virtual] |
begin the informational response
This will add the response name as well as the <response> tag tot he informational response object
response_name | name of the response this information represents | |
dhi | information about the request and response |
Reimplemented from BESInfo.
Definition at line 103 of file BESXMLInfo.cc.
References BESInfo::_response_name, BES_SCHEMA, BESDataHandlerInterface::data, MY_ENCODING, and REQUEST_ID.
void BESXMLInfo::begin_tag | ( | const string & | tag_name, | |
map< string, string > * | attrs = 0 | |||
) | [virtual] |
begin a tagged part of the information, information to follow
tag_name | name of the tag to begin | |
attrs | map of attributes to begin the tag with |
Reimplemented from BESInfo.
Definition at line 328 of file BESXMLInfo.cc.
References begin_tag().
void BESXMLInfo::begin_tag | ( | const string & | tag_name, | |
const string & | ns, | |||
const string & | uri, | |||
map< string, string > * | attrs = 0 | |||
) | [protected, virtual] |
begin a tagged part of the information, information to follow
tag_name | name of the tag to begin | |
ns | namespace name to include in the tag | |
uri | namespace uri | |
attrs | map of attributes to begin the tag with |
Definition at line 342 of file BESXMLInfo.cc.
References BESInfo::_response_name.
Referenced by add_data_from_file(), and begin_tag().
BESInfo * BESXMLInfo::BuildXMLInfo | ( | const string & | info_type | ) | [static] |
Definition at line 551 of file BESXMLInfo.cc.
References BESXMLInfo().
Referenced by BESDefaultModule::initialize().
void BESXMLInfo::dump | ( | ostream & | strm | ) | const [virtual] |
dumps information about this object
Displays the pointer value of this instance along with information about this XML informational object.
strm | C++ i/o stream to dump the information to |
Reimplemented from BESInfo.
Definition at line 541 of file BESXMLInfo.cc.
References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
void BESXMLInfo::end_response | ( | ) | [virtual] |
end the response
Add the terminating tags for the response and for the response name. If there are still tags that have not been closed then an exception is thrown.
Reimplemented from BESInfo.
Definition at line 197 of file BESXMLInfo.cc.
References BESInfo::_response_name.
Referenced by print(), and transmit().
void BESXMLInfo::end_tag | ( | const string & | tag_name | ) | [virtual] |
end a tagged part of the informational response
If the named tag is not the current tag then an error is thrown.
tag_name | name of the tag to end |
Reimplemented from BESInfo.
Definition at line 409 of file BESXMLInfo.cc.
References BESInfo::_response_name, and BESInfo::_strm.
Referenced by add_data_from_file().
virtual bool BESInfo::is_buffered | ( | ) | [inline, virtual, inherited] |
return whether the information is to be buffered or not.
Definition at line 123 of file BESInfo.h.
References BESInfo::_buffered.
Referenced by BESFilterTransmitter::send_html(), BESBasicHttpTransmitter::send_html(), BESFilterTransmitter::send_text(), and BESBasicHttpTransmitter::send_text().
void BESXMLInfo::print | ( | ostream & | strm | ) | [virtual] |
print the information from this informational object to the specified stream
strm | output to this stream |
Reimplemented from BESInfo.
Definition at line 524 of file BESXMLInfo.cc.
References end_response().
void BESXMLInfo::transmit | ( | BESTransmitter * | transmitter, | |
BESDataHandlerInterface & | dhi | |||
) | [virtual] |
transmit the text information as text
use the send_text method on the transmitter to transmit the information back to the client.
transmitter | The type of transmitter to use to transmit the info | |
dhi | information to help with the transmission |
Implements BESInfo.
Definition at line 508 of file BESXMLInfo.cc.
References end_response(), and BESTransmitter::send_text().
bool BESInfo::_buffered [protected, inherited] |
Definition at line 73 of file BESInfo.h.
Referenced by BESTextInfo::add_data(), BESHTMLInfo::add_data(), BESInfo::BESInfo(), BESInfo::dump(), BESInfo::is_buffered(), and BESInfo::print().
string BESInfo::_response_name [protected, inherited] |
Definition at line 77 of file BESInfo.h.
Referenced by add_tag(), begin_response(), BESInfo::begin_response(), begin_tag(), BESInfo::dump(), end_response(), and end_tag().
bool BESInfo::_response_started [protected, inherited] |
Definition at line 74 of file BESInfo.h.
Referenced by BESInfo::begin_response(), BESInfo::dump(), and BESInfo::end_response().
ostream* BESInfo::_strm [protected, inherited] |
Definition at line 71 of file BESInfo.h.
Referenced by BESTextInfo::add_data(), BESHTMLInfo::add_data(), BESInfo::BESInfo(), end_tag(), BESInfo::print(), and BESInfo::~BESInfo().
bool BESInfo::_strm_owned [protected, inherited] |
Definition at line 72 of file BESInfo.h.
Referenced by BESInfo::BESInfo(), and BESInfo::~BESInfo().
stack<string> BESInfo::_tags [protected, inherited] |
Definition at line 76 of file BESInfo.h.
Referenced by BESInfo::begin_tag(), BESInfo::dump(), BESInfo::end_response(), and BESInfo::end_tag().