version 1.128, 2005/10/31 22:35:04
|
version 1.145, 2006/11/01 20:29:49
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// Willis White (whiwill@us.ibm.com) PEP 127 and 128 | // Willis White (whiwill@us.ibm.com) PEP 127 and 128 |
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2 | // Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2 |
// Dave Sudlik, IBM (dsudlik@us.ibm.com) | // Dave Sudlik, IBM (dsudlik@us.ibm.com) |
// David Dillard, VERITAS Software Corp. |
// David Dillard, Symantec Corp. (david_dillard@symantec.com) |
// (david.dillard@veritas.com) |
|
// Vijay Eli, vijayeli@in.ibm.com, fix for #2571 | // Vijay Eli, vijayeli@in.ibm.com, fix for #2571 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
|
|
#include "CommonUTF.h" | #include "CommonUTF.h" |
#include "Buffer.h" | #include "Buffer.h" |
#include "StrLit.h" | #include "StrLit.h" |
|
#include "LanguageParser.h" |
|
#include "IDFactory.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
#define OUTPUT_CONTENTLENGTH \ | #define OUTPUT_CONTENTLENGTH \ |
{ \ | { \ |
char contentLengthP[11]; \ | char contentLengthP[11]; \ |
sprintf(contentLengthP,"%.10u", contentLength); \ |
int n = sprintf(contentLengthP,"%.10u", contentLength); \ |
out << STRLIT("content-length: ") << contentLengthP << STRLIT("\r\n"); \ |
out << STRLIT("content-length: "); \ |
|
out.append(contentLengthP, n); \ |
|
out << STRLIT("\r\n"); \ |
} | } |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
|
|
static const int _isSpecialChar7[] = | static const int _isSpecialChar7[] = |
{ | { |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0, | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0, |
0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, |
0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0, |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, |
}; | }; |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
Buffer& operator<<(Buffer& out, const char* x) |
|
{ |
|
XmlWriter::append(out, x); |
|
return out; |
|
} |
|
|
|
Buffer& operator<<(Buffer& out, char x) |
|
{ |
|
XmlWriter::append(out, x); |
|
return out; |
|
} |
|
|
|
Buffer& operator<<(Buffer& out, const Char16& x) | Buffer& operator<<(Buffer& out, const Char16& x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
|
|
| |
| |
// l10n | // l10n |
Buffer& operator<<(Buffer& out, const AcceptLanguages& al) |
Buffer& operator<<(Buffer& out, const AcceptLanguageList& al) |
{ | { |
XmlWriter::append(out, al.toString ()); |
XmlWriter::append(out, LanguageParser::buildAcceptLanguageHeader(al)); |
return out; | return out; |
} | } |
| |
// l10n | // l10n |
Buffer& operator<<(Buffer& out, const ContentLanguages& cl) |
Buffer& operator<<(Buffer& out, const ContentLanguageList& cl) |
{ | { |
XmlWriter::append(out, cl.toString ()); |
XmlWriter::append(out, LanguageParser::buildContentLanguageHeader(cl)); |
return out; | return out; |
} | } |
| |
|
|
void XmlWriter::appendSpecial(Buffer& out, const String& str) | void XmlWriter::appendSpecial(Buffer& out, const String& str) |
{ | { |
const Uint16* p = (const Uint16*)str.getChar16Data(); | const Uint16* p = (const Uint16*)str.getChar16Data(); |
size_t n = str.size(); |
// prevCharIsSpace is true when the last character written to the Buffer |
|
// is a space character (not a character reference). |
// Handle leading ASCII 7 characers in these next two loops (use unrolling). |
Boolean prevCharIsSpace = false; |
|
|
while (n >= 8) |
// If the first character is a space, use a character reference to avoid |
|
// space compression. |
|
if (*p == ' ') |
{ | { |
// The following condition is equivalent to this: |
out.append(STRLIT_ARGS(" ")); |
// (p[0] < 128 && p[1] < 128 && p[2] < 128 && p[3] < 128 && |
p++; |
// p[4] < 128 && p[5] < 128 && p[6] < 128 && p[7] < 128) |
} |
| |
if (((p[0]|p[1]|p[2]|p[3]|p[4]|p[5]|p[6]|p[7]) & 0xFF80) == 0) |
Uint16 c; |
|
while ((c = *p++) != 0) |
{ | { |
// Note: "|" is faster than "||" and achieves the same effect |
if (c < 128) |
// since p[i] is either 0 or 1. |
|
|
|
if (_isSpecialChar7[p[0]] | _isSpecialChar7[p[1]] | |
|
_isSpecialChar7[p[2]] | _isSpecialChar7[p[3]] | |
|
_isSpecialChar7[p[4]] | _isSpecialChar7[p[5]] | |
|
_isSpecialChar7[p[6]] | _isSpecialChar7[p[7]]) |
|
{ | { |
// Rare case. |
if (_isSpecialChar7[c]) |
_appendSpecialChar7(out, p[0]); |
{ |
_appendSpecialChar7(out, p[1]); |
// Write the character reference for the special character |
_appendSpecialChar7(out, p[2]); |
out.append( |
_appendSpecialChar7(out, p[3]); |
_specialChars[int(c)].str, _specialChars[int(c)].size); |
_appendSpecialChar7(out, p[4]); |
prevCharIsSpace = false; |
_appendSpecialChar7(out, p[5]); |
} |
_appendSpecialChar7(out, p[6]); |
else if (prevCharIsSpace && (c == ' ')) |
_appendSpecialChar7(out, p[7]); |
{ |
|
// Write the character reference for the space character, to |
|
// avoid compression |
|
out.append(STRLIT_ARGS(" ")); |
|
prevCharIsSpace = false; |
} | } |
else | else |
{ | { |
// Common case. |
out.append(c); |
out.append(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); |
prevCharIsSpace = (c == ' '); |
} | } |
p += 8; |
|
n -= 8; |
|
} | } |
else | else |
break; |
|
} |
|
|
|
while (n >= 4) |
|
{ | { |
// The following condition is equivalent to this: |
// Handle UTF8 case |
// (p[0] < 128 && p[1] < 128 && p[2] < 128 && p[3] < 128) |
|
| |
if (((p[0]|p[1]|p[2]|p[3]) & 0xFF80) == 0) |
if ((((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) || |
{ |
((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE))) && |
if (_isSpecialChar7[p[0]] | _isSpecialChar7[p[1]] | |
*p) |
_isSpecialChar7[p[2]] | _isSpecialChar7[p[3]]) |
|
{ | { |
// Rare case: |
_xmlWritter_appendSurrogatePair(out, c, *p++); |
_appendSpecialChar7(out, p[0]); |
|
_appendSpecialChar7(out, p[1]); |
|
_appendSpecialChar7(out, p[2]); |
|
_appendSpecialChar7(out, p[3]); |
|
} | } |
else | else |
{ | { |
// Common case: |
_xmlWritter_appendChar(out, c); |
out.append(p[0], p[1], p[2], p[3]); |
|
} | } |
| |
p += 4; |
prevCharIsSpace = false; |
n -= 4; |
|
} | } |
else |
|
break; |
|
} | } |
| |
// Process remaining characters. A UTF8 character must have been |
// If the last character is a space, use a character reference to avoid |
// encountered or this would have never been reached. |
// space compression. |
|
if (prevCharIsSpace) |
while (n--) |
|
{ |
|
Uint16 c = *p++; |
|
|
|
// Special processing for UTF8 case: |
|
|
|
if (c < 128) |
|
{ |
|
_appendSpecialChar7(out, c); |
|
continue; |
|
} |
|
|
|
// Hanlde UTF8 case (if reached). |
|
|
|
if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) || |
|
((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE))) |
|
{ |
|
Char16 highSurrogate = p[-1]; |
|
Char16 lowSurrogate = p[0]; |
|
p++; |
|
n--; |
|
|
|
_xmlWritter_appendSurrogatePair( |
|
out, Uint16(highSurrogate),Uint16(lowSurrogate)); |
|
} |
|
else |
|
{ | { |
_xmlWritter_appendSpecialChar(out, c); |
out.remove(out.size() - 1); |
} |
out.append(STRLIT_ARGS(" ")); |
} | } |
} | } |
| |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1, | 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1, |
}; | }; |
| |
|
// Perform the necessary URI encoding of characters in HTTP header values. |
|
// This is required by the HTTP/1.1 specification and the CIM/HTTP |
|
// Specification (section 3.3.2). |
static void _xmlWritter_encodeURIChar(String& outString, Sint8 char8) | static void _xmlWritter_encodeURIChar(String& outString, Sint8 char8) |
{ | { |
Uint8 c = (Uint8)char8; | Uint8 c = (Uint8)char8; |
|
|
| |
char* nameSpaceCopy = strdup(nameSpace.getString().getCString()); | char* nameSpaceCopy = strdup(nameSpace.getString().getCString()); |
| |
#if !defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
#if !defined(PEGASUS_COMPILER_MSVC) && !defined(PEGASUS_OS_ZOS) |
char *last; | char *last; |
for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p; | for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p; |
p = strtok_r(NULL, "/", &last)) | p = strtok_r(NULL, "/", &last)) |
|
|
| |
inline void _xmlWritter_appendValue(Buffer& out, const CIMDateTime& x) | inline void _xmlWritter_appendValue(Buffer& out, const CIMDateTime& x) |
{ | { |
out << x.toString(); //ATTN: append() method? |
// It is not necessary to use XmlWriter::appendSpecial(), because |
|
// CIMDateTime values do not contain special characters. |
|
out << x.toString(); |
} | } |
| |
inline void _xmlWritter_appendValue(Buffer& out, const CIMObjectPath& x) | inline void _xmlWritter_appendValue(Buffer& out, const CIMObjectPath& x) |
|
|
_xmlWritter_appendValueArray(out, a.getData(), a.size()); | _xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
|
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
|
case CIMTYPE_INSTANCE: |
|
{ |
|
Array<CIMInstance> a; |
|
value.get(a); |
|
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
|
break; |
|
} |
|
#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
default: | default: |
PEGASUS_ASSERT(false); | PEGASUS_ASSERT(false); |
} | } |
|
|
_xmlWritter_appendValue(out, v); | _xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
|
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
|
case CIMTYPE_INSTANCE: |
|
{ |
|
CIMInstance v; |
|
value.get(v); |
|
_xmlWritter_appendValue(out, v); |
|
break; |
|
} |
|
#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
default: | default: |
PEGASUS_ASSERT(false); | PEGASUS_ASSERT(false); |
} | } |
|
|
const String& cimObject, | const String& cimObject, |
const String& authenticationHeader, | const String& authenticationHeader, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const AcceptLanguages & acceptLanguages, |
const AcceptLanguageList& acceptLanguages, |
const ContentLanguages & contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength) | Uint32 contentLength) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
|
|
| |
static const char *clientTransferEncodingOff = | static const char *clientTransferEncodingOff = |
getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST"); | getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST"); |
|
|
if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0') | if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0') |
#endif | #endif |
| |
|
|
void XmlWriter::appendMethodResponseHeader( | void XmlWriter::appendMethodResponseHeader( |
Buffer& out, | Buffer& out, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages & contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength, | Uint32 contentLength, |
Uint32 serverResponseTime) |
Uint64 serverResponseTime) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n"); | out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n"); |
STAT_SERVERTIME |
|
|
#ifndef PEGASUS_DISABLE_PERFINST |
|
if (StatisticalData::current()->copyGSD) |
|
{ |
|
out << STRLIT("WBEMServerResponseTime: ") << |
|
CIMValue(serverResponseTime).toString() << STRLIT("\r\n"); |
|
} |
|
#endif |
|
|
out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n"); | out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n"); |
OUTPUT_CONTENTLENGTH; | OUTPUT_CONTENTLENGTH; |
| |
|
|
} | } |
if (errorDetail != String::EMPTY) | if (errorDetail != String::EMPTY) |
{ | { |
// ATTN-RK-P3-20020404: It is critical that this text not contain '\n' |
|
// ATTN-RK-P3-20020404: Need to encode this value properly. (See |
|
// CIM/HTTP Specification section 3.3.2 |
|
out << STRLIT(PEGASUS_HTTPHEADERTAG_ERRORDETAIL ": ") | out << STRLIT(PEGASUS_HTTPHEADERTAG_ERRORDETAIL ": ") |
<< encodeURICharacters(errorDetail) << STRLIT("\r\n"); | << encodeURICharacters(errorDetail) << STRLIT("\r\n"); |
} | } |
|
|
out << STRLIT("<ERROR"); | out << STRLIT("<ERROR"); |
out << STRLIT(" CODE=\"") << Uint32(cimException.getCode()); | out << STRLIT(" CODE=\"") << Uint32(cimException.getCode()); |
out.append('"'); | out.append('"'); |
|
|
String description = TraceableCIMException(cimException).getDescription(); | String description = TraceableCIMException(cimException).getDescription(); |
|
|
if (description != String::EMPTY) | if (description != String::EMPTY) |
{ | { |
out << STRLIT(" DESCRIPTION=\""); | out << STRLIT(" DESCRIPTION=\""); |
appendSpecial(out, description); | appendSpecial(out, description); |
out.append('"'); | out.append('"'); |
} | } |
|
|
|
if (cimException.getErrorCount()) |
|
{ |
|
out << STRLIT(">"); |
|
|
|
for (Uint32 i = 0, n = cimException.getErrorCount(); i < n; i++) |
|
appendInstanceElement(out, cimException.getError(i)); |
|
|
|
out << STRLIT("</ERROR>"); |
|
} |
|
else |
out << STRLIT("/>"); | out << STRLIT("/>"); |
} | } |
| |
|
|
out << STRLIT(" PARAMTYPE=\"string\""); | out << STRLIT(" PARAMTYPE=\"string\""); |
out << STRLIT(" EMBEDDEDOBJECT=\"object\""); | out << STRLIT(" EMBEDDEDOBJECT=\"object\""); |
} | } |
|
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
|
else if (type == CIMTYPE_INSTANCE) |
|
{ |
|
out << STRLIT(" PARAMTYPE=\"string\""); |
|
out << STRLIT(" EMBEDDEDOBJECT=\"instance\""); |
|
} |
|
#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
else | else |
{ | { |
out << STRLIT(" PARAMTYPE=\"") << cimTypeToString (type); | out << STRLIT(" PARAMTYPE=\"") << cimTypeToString (type); |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// appendQualifierNameIParameter() |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
void XmlWriter::appendQualifierNameIParameter( |
|
Buffer& out, |
|
const char* name, |
|
const String& qualifierName) |
|
{ |
|
// <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE |
|
// |INSTANCENAME|CLASSNAME|QUALIFIER.DECLARATION |
|
// |CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?> |
|
// |
|
// ATTN: notice that there is really no way to pass a qualifier name |
|
// as an IPARAMVALUE element according to the spec (look above). So we |
|
// just pass it as a class name. An answer must be obtained later. |
|
|
|
_appendIParamValueElementBegin(out, name); |
|
appendClassNameElement(out, qualifierName); |
|
_appendIParamValueElementEnd(out); |
|
} |
|
|
|
//------------------------------------------------------------------------------ |
|
// |
|
// appendClassNameIParameter() | // appendClassNameIParameter() |
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& httpAcceptLanguages, |
const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguages& httpContentLanguages) |
const ContentLanguageList& httpContentLanguages) |
{ | { |
Buffer out; | Buffer out; |
Buffer tmp; | Buffer tmp; |
|
|
const CIMName& methodName, | const CIMName& methodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages & httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body, | const Buffer& body, |
Uint32 serverResponseTime, |
Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
Boolean isLast) | Boolean isLast) |
{ | { |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& httpAcceptLanguages, |
const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguages& httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body) | const Buffer& body) |
{ | { |
Buffer out; | Buffer out; |
|
|
const CIMName& iMethodName, | const CIMName& iMethodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages & httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body, | const Buffer& body, |
Uint32 serverResponseTime, |
Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
Boolean isLast) | Boolean isLast) |
{ | { |
|
|
const CIMName& cimMethod, | const CIMName& cimMethod, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& acceptLanguages, |
const AcceptLanguageList& acceptLanguages, |
const ContentLanguages& contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength) | Uint32 contentLength) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
|
|
void XmlWriter::appendEMethodResponseHeader( | void XmlWriter::appendEMethodResponseHeader( |
Buffer& out, | Buffer& out, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages& contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength) | Uint32 contentLength) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& httpAcceptLanguages, |
const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguages& httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body) | const Buffer& body) |
{ | { |
Buffer out; | Buffer out; |
|
|
const CIMName& eMethodName, | const CIMName& eMethodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages& httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body) | const Buffer& body) |
{ | { |
Buffer out; | Buffer out; |
|
|
case XmlEntry::CDATA: | case XmlEntry::CDATA: |
{ | { |
_xmlWritter_indent(os, stack.size(), indentChars); | _xmlWritter_indent(os, stack.size(), indentChars); |
os << "<![CDATA[...]]>"; |
os << "<![CDATA[" << entry.text << "]]>"; |
break; | break; |
} | } |
| |
|
|
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
|
static IDFactory _messageIDFactory(1000); |
|
|
String XmlWriter::getNextMessageId() | String XmlWriter::getNextMessageId() |
{ | { |
// ATTN: make thread-safe: |
|
static Uint32 messageId = 1000; |
|
|
|
messageId++; |
|
|
|
if (messageId < 1000) |
|
messageId = 1001; |
|
|
|
char buffer[16]; | char buffer[16]; |
sprintf(buffer, "%d", messageId); |
sprintf(buffer, "%u", _messageIDFactory.getID()); |
return buffer; | return buffer; |
} | } |
| |