version 1.169, 2009/12/15 11:39:34
|
version 1.169.4.1, 2011/01/15 21:26:53
|
|
|
out << STRLIT("</VALUE.NAMEDINSTANCE>\n"); | out << STRLIT("</VALUE.NAMEDINSTANCE>\n"); |
} | } |
| |
|
//EXP_PULL |
|
//------------------------------------------------------------------------------ |
|
// |
|
// appendValueInstanceWithPathElement() |
|
// |
|
// <!ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH,INSTANCE)> |
|
// |
|
//------------------------------------------------------------------------------ |
|
// EXP_PULL_TBD checkout the INSTANCEPATH vs NAMEDINSTANCE |
|
void XmlWriter::appendValueInstanceWithPathElement( |
|
Buffer& out, |
|
const CIMInstance& namedInstance) |
|
{ |
|
out << STRLIT("<VALUE.INSTANCEWITHPATH>\n"); |
|
|
|
appendInstancePathElement(out, namedInstance.getPath ()); |
|
appendInstanceElement(out, namedInstance); |
|
|
|
out << STRLIT("</VALUE.INSTANCEWITHPATH>\n"); |
|
} |
|
//EXP_PULL_END |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// appendClassElement() | // appendClassElement() |
|
|
static const char *clientTransferEncodingOff = | static const char *clientTransferEncodingOff = |
getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST"); | getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST"); |
| |
if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0') |
// EXP_PULL_TEMP DELETE |
|
// KS_TODO - Remove this. Temp to insure no chunking during testing |
|
// if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0') |
#endif | #endif |
| |
|
// EXP_PULL TEMP DELETE out << STRLIT("TE: chunked, trailers\r\n"); |
|
|
if (!binaryResponse) | if (!binaryResponse) |
{ | { |
// The binary protocol does not allow chunking. | // The binary protocol does not allow chunking. |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
|
// _appendParamValueElementBegin() |
|
// _appendParamValueElementEnd() |
|
// |
|
// <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE |
|
// |INSTANCENAME|CLASSNAME|QUALIFIER.DECLARATION |
|
// |CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?> |
|
// <!ATTLIST IPARAMVALUE %CIMName;> |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
void XmlWriter::_appendParamValueElementBegin( |
|
Buffer& out, |
|
const char* name) |
|
{ |
|
out << STRLIT("<PARAMVALUE NAME=\"") << name << STRLIT("\">\n"); |
|
} |
|
|
|
void XmlWriter::_appendParamValueElementEnd( |
|
Buffer& out) |
|
{ |
|
out << STRLIT("</PARAMVALUE>\n"); |
|
} |
|
//------------------------------------------------------------------------------ |
|
// |
// _appendSimpleRspElementBegin() | // _appendSimpleRspElementBegin() |
// _appendSimpleRspElementEnd() | // _appendSimpleRspElementEnd() |
// | // |
|
|
out << STRLIT("</IRETURNVALUE>\n"); | out << STRLIT("</IRETURNVALUE>\n"); |
} | } |
| |
|
//EXP_PULL_BEGIN |
|
void XmlWriter::_appendIReturnValueElementWithNameBegin( |
|
Buffer& out, |
|
const char* name) |
|
{ |
|
out << STRLIT("<IRETURNVALUE NAME=\"") << name << STRLIT("\">\n"); |
|
} |
|
//EXP_PULL_END |
|
|
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// appendBooleanIParameter() | // appendBooleanIParameter() |
|
|
_appendIParamValueElementEnd(out); | _appendIParamValueElementEnd(out); |
} | } |
| |
|
//EXP_PULL_BEGIN |
|
void XmlWriter::appendBooleanParameter( |
|
Buffer& out, |
|
const char* name, |
|
Boolean flag) |
|
{ |
|
_appendParamValueElementBegin(out, name); |
|
out << STRLIT("<VALUE>"); |
|
append(out, flag); |
|
out << STRLIT("</VALUE>\n"); |
|
_appendParamValueElementEnd(out); |
|
} |
|
|
|
void XmlWriter::appendBooleanIReturnValue( |
|
Buffer& out, |
|
const char* name, |
|
Boolean flag) |
|
{ |
|
_appendIReturnValueElementWithNameBegin(out, name); |
|
out << STRLIT("<VALUE>"); |
|
append(out, flag); |
|
out << STRLIT("</VALUE>\n"); |
|
_appendIReturnValueElementEnd(out); |
|
} |
|
|
|
// Can be used to generate either parameters with value, |
|
// parameters with NULL (i.e. no value element) or |
|
// no parameters output at all. |
|
void XmlWriter::appendUint32IParameter( |
|
Buffer& out, |
|
const char* name, |
|
const Uint32Arg& val, |
|
const Boolean required) |
|
{ |
|
if (!required && val.isNull()) |
|
{ |
|
return; |
|
} |
|
|
|
_appendIParamValueElementBegin(out, name); |
|
if (!val.isNull()) |
|
{ |
|
out << STRLIT("<VALUE>"); |
|
append(out, val.getValue()); |
|
out << STRLIT("</VALUE>\n"); |
|
} |
|
_appendIParamValueElementEnd(out); |
|
} |
|
|
|
/* Output return value from Uint64Arg object as |
|
Value inside IRETURNVALUE |
|
If the state of the object is NULL output |
|
the parameter without value. Else |
|
output the value |
|
*/ |
|
void XmlWriter::appendUint64ReturnValue( |
|
Buffer& out, |
|
const char* name, |
|
const Uint64Arg& val) |
|
{ |
|
_appendIReturnValueElementBegin(out); |
|
out << STRLIT("<VALUE>"); |
|
if (!val.isNull()) |
|
{ |
|
append(out, val.getValue()); |
|
} |
|
out << STRLIT("</VALUE>\n"); |
|
_appendIReturnValueElementEnd(out); |
|
} |
|
//EXP_PULL_END |
|
|
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// appendStringIParameter() | // appendStringIParameter() |
|
|
_appendIParamValueElementEnd(out); | _appendIParamValueElementEnd(out); |
} | } |
| |
|
// EXP_PULL |
|
//------------------------------------------------------------------------------ |
|
// |
|
// appendStringIParameterIfNotEmpty() |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
void XmlWriter::appendStringIParameterIfNotEmpty( |
|
Buffer& out, |
|
const char* name, |
|
const String& str) |
|
{ |
|
if (str != String::EMPTY) |
|
{ |
|
appendStringIParameter(out,name,str); |
|
} |
|
} |
|
|
|
//------------------------------------------------------------------------------ |
|
// |
|
// appendStringParameter() |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
void XmlWriter::appendStringParameter( |
|
Buffer& out, |
|
const char* name, |
|
const String& str) |
|
{ |
|
_appendParamValueElementBegin(out, name); |
|
out << STRLIT("<VALUE>"); |
|
appendSpecial(out, str); |
|
out << STRLIT("</VALUE>\n"); |
|
_appendParamValueElementEnd(out); |
|
} |
|
|
|
//------------------------------------------------------------------------------ |
|
// |
|
// appendStringIReturnValue() |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
void XmlWriter::appendStringIReturnValue( |
|
Buffer& out, |
|
const char* name, |
|
const String& str) |
|
{ |
|
_appendIReturnValueElementWithNameBegin(out, name); |
|
out << STRLIT("<VALUE>"); |
|
appendSpecial(out, str); |
|
out << STRLIT("</VALUE>\n"); |
|
_appendIReturnValueElementEnd(out); |
|
} |
|
//EXP_PULL_END |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// appendClassNameIParameter() | // appendClassNameIParameter() |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguageList& httpContentLanguages, | const ContentLanguageList& httpContentLanguages, |
|
const Buffer& bodyParams, |
const Buffer& body, | const Buffer& body, |
Uint64 serverResponseTime, | Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
|
|
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
|
/* |
|
Formats a IMethod Response Message. Note that this function formats |
|
messages for chunking based on the isFirst and isLast parameters. |
|
If isFirst is set, it outputs headers and ResponseElement begin. |
|
It always sends the body. If isLast is set, it sends the rtnParams |
|
and the ResponseElement end followed by any parameter in the rtnParams. |
|
KS_PULL_TBD_TODO - Determine what we want to do with chunking. Since this |
|
This whole thing is based on the concept of each message sending a single |
|
chunk and we will want in the future to modify so we can chose easily |
|
whether we want to chunk or not and send the chunks. |
|
*/ |
Buffer XmlWriter::formatSimpleIMethodRspMessage( | Buffer XmlWriter::formatSimpleIMethodRspMessage( |
const CIMName& iMethodName, | const CIMName& iMethodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguageList& httpContentLanguages, | const ContentLanguageList& httpContentLanguages, |
|
const Buffer& rtnParams, |
const Buffer& body, | const Buffer& body, |
Uint64 serverResponseTime, | Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
|
|
{ | { |
if (body.size() != 0 || isFirst == false) | if (body.size() != 0 || isFirst == false) |
_appendIReturnValueElementEnd(out); | _appendIReturnValueElementEnd(out); |
|
// EXP_PULL |
|
// If there are any parameters include them here. |
|
// Assumes that it is prebuilt with all components |
|
// |
|
if (rtnParams.size() != 0) |
|
{ |
|
out << rtnParams; |
|
} |
|
// |
|
// //EXP_PULL_END |
_appendIMethodResponseElementEnd(out); | _appendIMethodResponseElementEnd(out); |
_appendSimpleRspElementEnd(out); | _appendSimpleRspElementEnd(out); |
_appendMessageElementEnd(out); | _appendMessageElementEnd(out); |