CustomContentHandlers Demo code in C++

<< Click to Display Table of Contents >>

Navigation:  Forum >

CustomContentHandlers Demo code in C++

Forum link

 


 

01-26-2019, 04:48 AM:

 

I Am using IntraWeb Version: 15.0.17

 

I have downloaded demo from https://github.com/Atozed/IntraWeb.

 

I need C++ code for the  delphi demo CustomContentHandlers.

 

In my project I need to send xml data to client depending on the parameter they have provided and CustomContentHandlers demo is doing exactly what I want but it is in delphi and I am unable to convert it to C++ code.

 

I tried but not working it says (404 file not found)

 

code writen by me

 

in ServerController.cpp

 

void __fastcall TIWServerController::IWServerControllerBaseConfig(TObject *Sender)

 

{

 

  THandlers::Add("", " GiveMeSomeXML", new  TContentXML());

 

}

 

in IW.Content.XML.cpp

 

 __fastcall  TContentXML :: TContentXML ()

 

{

 

}

 

__fastcall  TContentXML ::~ TContentXML ()

 

{

 

}

 

bool __fastcall  TContentXML ::Execute(Iw::Http::Request::THttpRequest* aRequest, Iw::Http::Reply::THttpReply* aReply, const System::UnicodeString aPathname,

 

                                          Iwapplication::TIWApplication* aSession, System::Classes::TStrings* aParams)

 

{

 

 aReply->ContentType = "text/xml";;

 

 aReply->WriteString("<xml>My xml content here</xml>");

 

}

 

in IW.Content.XML.h

 

class TContentXML : public Iw::Content::Base::TContentBase

 

{

 

private:    // User declarations

 

public:        // User declarations

 

   __fastcall virtual  TContentXML ();

 

   __fastcall  ~ TContentXML (void);

 

   virtual bool __fastcall Execute(Iw::Http::Request::THttpRequest* aRequest, Iw::Http::Reply::THttpReply* aReply, const System::UnicodeString aPathname, Iwapplication::TIWApplication* aSession, System::Classes::TStrings* aParams);

 

};

 

I know I have not converted it properly please help me