(file) Return to XmlWriter.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlWriter.cpp between version 1.112 and 1.113

version 1.112, 2004/10/17 20:39:18 version 1.113, 2004/10/25 18:26:02
Line 35 
Line 35 
 //              Amit K Arora, IBM (amita@in.ibm.com) for PEP#101 //              Amit K Arora, IBM (amita@in.ibm.com) for PEP#101
 //              Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1 //              Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1
 //              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
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 1728 
Line 1729 
         out << "Content-Language: " << contentLanguages << "\r\n";         out << "Content-Language: " << contentLanguages << "\r\n";
     }     }
  
   #ifdef PEGASUS_DEBUG
                 // backdoor environment variable to turn OFF client requesting transfer                 // backdoor environment variable to turn OFF client requesting transfer
                 // encoding. The default is on. to turn off, set this variable to zero.                 // encoding. The default is on. to turn off, set this variable to zero.
                 // This should be removed when stable. This should only be turned off in                 // This should be removed when stable. This should only be turned off in
                 // a debugging/testing environment.                 // a debugging/testing environment.
 #ifdef PEGASUS_DEBUG  
                 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
   
                         out << "TE: chunked, trailers" << "\r\n";                         out << "TE: chunked, trailers" << "\r\n";
  
     if (httpMethod == HTTP_METHOD_M_POST)     if (httpMethod == HTTP_METHOD_M_POST)
Line 1765 
Line 1768 
 } }
  
  
 //------------------------------------------------------------------------------  
 //  
 // appendMethodResponseHeader()  
 //  
 //     Build HTTP response header.  
 //  
 //------------------------------------------------------------------------------  
   
 void XmlWriter::appendMethodResponseHeader(  
     Array<Sint8>& out,  
     HttpMethod httpMethod,  
     const ContentLanguages & contentLanguages,  
     Uint32 contentLength)  
 {  
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };  
   
     out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";  
     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";  
                 OUTPUT_CONTENTLENGTH;  
   
     if (contentLanguages.size() > 0)  
     {  
         out << "Content-Language: " << contentLanguages << "\r\n";  
     }  
     if (httpMethod == HTTP_METHOD_M_POST)  
     {  
         out << "Ext:\r\n";  
         out << "Cache-Control: no-cache\r\n";  
         out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";  
         out << nn <<"\r\n";  
         out << nn << "-CIMOperation: MethodResponse\r\n\r\n";  
     }  
     else  
     {  
         out << "CIMOperation: MethodResponse\r\n\r\n";  
     }  
 }  
   
   
  void XmlWriter::appendMethodResponseHeader(  void XmlWriter::appendMethodResponseHeader(
      Array<Sint8>& out,      Array<Sint8>& out,
      HttpMethod httpMethod,      HttpMethod httpMethod,
Line 1812 
Line 1776 
      Uint64 serverResponseTime)      Uint64 serverResponseTime)
  {  {
      char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };      char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
   
      out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";      out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";
      STAT_SERVERTIME      STAT_SERVERTIME
      out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";      out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
Line 2397 
Line 2360 
 //     <IPARAMVALUE NAME="PropertyName"><VALUE>FreeSpace</VALUE></IPARAMVALUE> //     <IPARAMVALUE NAME="PropertyName"><VALUE>FreeSpace</VALUE></IPARAMVALUE>
 // //
 //     USE: Create parameter for getProperty operation //     USE: Create parameter for getProperty operation
 //-----------------------------------------------------------  //==========================================================
 void XmlWriter::appendPropertyNameIParameter( void XmlWriter::appendPropertyNameIParameter(
     Array<Sint8>& out,     Array<Sint8>& out,
     const CIMName& propertyName)     const CIMName& propertyName)
Line 2540 
Line 2503 
     return tmp;     return tmp;
 } }
  
 Array<Sint8> XmlWriter::formatSimpleMethodRspMessage(  
     const CIMName& methodName,  
     const String& messageId,  
     HttpMethod httpMethod,  
     const ContentLanguages & httpContentLanguages,  
     const Array<Sint8>& body,  
                 Boolean isFirst,  
                 Boolean isLast)  
 {  
         Array<Sint8> out;  
   
         if (isFirst == true)  
         {  
                 // NOTE: temporarily put zero for content length. the http code  
                 // will later decide to fill in the length or remove it altogether  
                 appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0);  
                 _appendMessageElementBegin(out, messageId);  
                 _appendSimpleRspElementBegin(out);  
                 _appendMethodResponseElementBegin(out, methodName);  
         }  
   
         if (body.size() != 0)  
         {  
                 out << body;  
         }  
   
         if (isLast == true)  
         {  
                 _appendMethodResponseElementEnd(out);  
                 _appendSimpleRspElementEnd(out);  
                 _appendMessageElementEnd(out);  
         }  
   
         return out;  
 }  
   
   
 //PEP 128 adding serverRsponseTime to header //PEP 128 adding serverRsponseTime to header
 Array<Sint8> XmlWriter::formatSimpleMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleMethodRspMessage(
     const CIMName& methodName,     const CIMName& methodName,
Line 2594 
Line 2520 
         {         {
                 // NOTE: temporarily put zero for content length. the http code                 // NOTE: temporarily put zero for content length. the http code
                 // will later decide to fill in the length or remove it altogether                 // will later decide to fill in the length or remove it altogether
                 appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0, serverResponseTime);                  appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0,
                                                                                                                            serverResponseTime);
                 _appendMessageElementBegin(out, messageId);                 _appendMessageElementBegin(out, messageId);
                 _appendSimpleRspElementBegin(out);                 _appendSimpleRspElementBegin(out);
                 _appendMethodResponseElementBegin(out, methodName);                 _appendMethodResponseElementBegin(out, methodName);
Line 2706 
Line 2633 
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const ContentLanguages & httpContentLanguages,     const ContentLanguages & httpContentLanguages,
     const Array<Sint8>& body,     const Array<Sint8>& body,
                 Boolean isFirst,  
                 Boolean isLast)  
 {  
     Array<Sint8> out;  
   
                 if (isFirst == true)  
                 {  
                         // NOTE: temporarily put zero for content length. the http code  
                         // will later decide to fill in the length or remove it altogether  
                         appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0);  
                         _appendMessageElementBegin(out, messageId);  
                         _appendSimpleRspElementBegin(out);  
                         _appendIMethodResponseElementBegin(out, iMethodName);  
                         if (body.size() != 0)  
                                 _appendIReturnValueElementBegin(out);  
                 }  
   
     if (body.size() != 0)  
     {  
                         out << body;  
     }  
   
                 if (isLast == true)  
                 {  
                         if (body.size() != 0)  
                                 _appendIReturnValueElementEnd(out);  
                         _appendIMethodResponseElementEnd(out);  
                         _appendSimpleRspElementEnd(out);  
                         _appendMessageElementEnd(out);  
                 }  
   
     return out;  
 }  
   
   
   
 Array<Sint8> XmlWriter::formatSimpleIMethodRspMessage(  
     const CIMName& iMethodName,  
     const String& messageId,  
     HttpMethod httpMethod,  
     const ContentLanguages & httpContentLanguages,  
     const Array<Sint8>& body,  
         Uint64 serverResponseTime,         Uint64 serverResponseTime,
                 Boolean isFirst,                 Boolean isFirst,
                 Boolean isLast)                 Boolean isLast)
Line 2758 
Line 2643 
                 {                 {
                         // NOTE: temporarily put zero for content length. the http code                         // NOTE: temporarily put zero for content length. the http code
                         // will later decide to fill in the length or remove it altogether                         // will later decide to fill in the length or remove it altogether
                         appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0, serverResponseTime);                          appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0,
                                                                                                                                    serverResponseTime);
                         _appendMessageElementBegin(out, messageId);                         _appendMessageElementBegin(out, messageId);
                         _appendSimpleRspElementBegin(out);                         _appendSimpleRspElementBegin(out);
                         _appendIMethodResponseElementBegin(out, iMethodName);                         _appendIMethodResponseElementBegin(out, iMethodName);
                         if (body.size() != 0)  
                           // output the start of the return tag. Test if there is response data by:
                           // 1. there is data on the first chunk OR
                           // 2. there is no data on the first chunk but isLast is false implying
                           //    there is more non-empty data to come. If all subsequent chunks
                           //    are empty, then this generates and empty response.
                           if (body.size() != 0 || isLast == false)
                                 _appendIReturnValueElementBegin(out);                                 _appendIReturnValueElementBegin(out);
                 }                 }
  
Line 2773 
Line 2665 
  
                 if (isLast == true)                 if (isLast == true)
                 {                 {
                         if (body.size() != 0)                          if (body.size() != 0 || isFirst == false)
                                 _appendIReturnValueElementEnd(out);                                 _appendIReturnValueElementEnd(out);
                         _appendIMethodResponseElementEnd(out);                         _appendIMethodResponseElementEnd(out);
                         _appendSimpleRspElementEnd(out);                         _appendSimpleRspElementEnd(out);
Line 2865 
Line 2757 
         out << "Content-Language: " << contentLanguages << "\r\n";         out << "Content-Language: " << contentLanguages << "\r\n";
     }     }
  
   #ifdef PEGASUS_DEBUG
                 // backdoor environment variable to turn OFF client requesting transfer                 // backdoor environment variable to turn OFF client requesting transfer
                 // encoding. The default is on. to turn off, set this variable to zero.                 // encoding. The default is on. to turn off, set this variable to zero.
                 // This should be removed when stable. This should only be turned off in                 // This should be removed when stable. This should only be turned off in
                 // a debugging/testing environment.                 // a debugging/testing environment.
 #ifdef PEGASUS_DEBUG  
                 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')


Legend:
Removed from v.1.112  
changed lines
  Added in v.1.113

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2