Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CustomContentHandlers
#1
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
Reply
#2
it is solved.
I missed to add "mFileMustExist = false;"
thats way it was giving error file not found 404 error

__fastcall TContentXML::TContentXML()
{
mFileMustExist = false;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)