Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Search Forums » Search Results » View Thread |
Messages 1 to 5 of 5 total |
RequestHeaders NULL |
Sat, Mar 12 2016 7:05 AM | Permanent Link |
squiffy Telemix Ltd. | I have TAjax class which creates a TServerRequest field and instantiates it in the constructor. I can manipulate (ie set) most of the properties (url, method and the like) but I get an error when I try to add a header by calling RequestHeaders methods. Here's an extract of the code (I can post more if this isn't enough, just trying to not clutter the post) : type TAjax = class(TObject) URL : TServerRequestURL; Method : TRequestMethod; ajax : TServerRequest; .... etc constructor TAjax.Create(tok : String); begin self.ajax := TServerRequest.Create; self.Method := rmPost; self.URL := '/dummy'; ... // This kills it : self.ajax.RequestContent.Clear; When I create new instance any reference to RequestContent (clear / add / etc) causes the attached error. I do a console log in the JS file (on FF) just before to check the ajax object exists, and it does. It has all the methods listed with "null" values (but the properties I set are as expected). I expect them to be null as I haven't set them, but surely I should be able to clear / add etc.? All is fine if I don't use my class (ie I just create a new TServerRequest object inline in my code and use that) so it must be my class - but where? Attachments: ewbajaxerror.PNG |
Sat, Mar 12 2016 7:34 AM | Permanent Link |
squiffy Telemix Ltd. | Missed out how I call it : var myajax : TAjax; begin myajax := TAjax.Create(getToken); So I logged the following in the constructor : BoolToStr(Assigned(ajax)) which was True, then BoolToStr(Assigned(ajax.RequestContent)) which was False Does this mean that despite appearing to create a new instance of TServerRequest into ajax, I'm not really? I think I just can't see the wood from the trees. |
Sat, Mar 12 2016 8:12 AM | Permanent Link |
squiffy Telemix Ltd. | PLEASE IGNORE all this codswallop. I have a problem, but the above doesn't explain it well. Going to have some bacon and eggs then come back to it. I'll probably start a new thread. |
Sat, Mar 12 2016 8:54 AM | Permanent Link |
squiffy Telemix Ltd. | Sorted. the TServerRequest.Create line needed (nil). Haven't looked into why yet (I assumed it was implied), but all seems to work now. |
Mon, Mar 14 2016 8:23 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << Sorted. the TServerRequest.Create line needed (nil). Haven't looked into why yet (I assumed it was implied), but all seems to work now. >> Because TServerRequest is a component, and that's how you call the overridden (from TComponent) constructor. The way you had it, you were calling the base TObject.Create method, which won't create the necessary bits for the TServerRequest component. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Thursday, December 5, 2024 at 09:15 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |