Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IW 15.1.7 handlers randomic problem
#1
With IW 15.1.17

I have a handler, a Form using a Html TemplateForm  and a JS code used in document.ready().

I have in my app many handlers.

In the local network and with amazon EC2 I am using WIFI with my home router. I am not using  internet provider from mobile.

I am having randomic "404 error" with "resource not found" when using the app with the chrome browser in my mobile and Amazon EC2 Server.

Sometimes the Handler works, other times doesn´t work. When I tried debug I see it is trowing an error of  "404 - resource not found", randomically.


If I use the Chrome Desktop or my mobile with chrome  connected with IW server installed  in a PC  in the local network, there is no problem.

If I use the Chrome Desktop connected with IW server installed  in Amazon EC2 , I have no problem.

The  problem  only occur when  using chrome browser of my cell phone and  IW server in Amazon EC2.

I have noted that the problem happens when I use the crome browser of my mobile. If I use the default browser of my mobile there is no problem.
I have Android Oreo in the mobile and it is a recent Cell phone. So Chrome os updated in version 78.0.3904.62
What can be causing it?

//IW Handler
Code:
function TContentAgenda.Execute(aRequest: THttpRequest; aReply: THttpReply;
  const aPathname: string; aSession: TIWApplication;
  aParams: TStrings): boolean;
var
  jso,js:TJsonObject;
  ja:TjsonArray;
begin
  Result:=True;
  js:=TJSonObject.Create;
  ja:=TjsonArray.Create;
  try
    with Controller.DM.FDQQuery do begin
      Close;
      SQL.Clear;
      SQL.Add('Select A.* from TableTeste');
      .....
  js.AddPair('draw',TJSONString.Create(_draw));
      js.AddPair('recordsTotal',TJSONString.Create(....));
      js.AddPair('recordsFiltered',TJSONString.Create(....));
      js.AddPair('data',ja);
      wresult:=js.toJson;
Close;
  finally
    js.Free;
  end;
  aReply.WriteString(wresult);
end;

//JS code in html Template Form

Code:
<script>
  $(document).ready(function () {
    function listaAgenda() {
      let params = {
        data_inicial: moment().format('DD/MM/YYYY'),
        data_final: moment().add(1, 'days').format('DD/MM/YYYY'),
        med_ag: $('#IWUSU').val() || ''
      };
      //encodeURI
      $.ajax('/GetAgenda?' + encodeURI($.param(params)))
        .done(resp => {
          let out = JSON.parse(resp);
          let context = { qtde: out.recordsFiltered, items: out.data };
          context.hasItems = (parseInt(context.qtde, 10) > 0);
          let html = template_agenda_script(context);
          $("#id_agenda_menu").html(html);
        }).fail(erro => {
          alert(JSON.stringify(erro))
        })
    };
    listaAgenda()
  })
</script>
Reply
#2
1) Set a log function (be sure to make sure its threadsafe) in your content handler and log the IP and browser as well. See if the browser is in fact requesting this content handler.

2) Add an exception handler to your content handler and return a message to see if there are errors ocurring during run.

3) Try adding a code based break in the JS
https://stackoverflow.com/questions/1005...-in-chrome
And then trace your ready function in the browser.

4) Grab the URL for the CH request after the session starts and paste it into a new tab in the same browser and see what the results are.
Reply
#3
Are you sure your application is receiving the request and dealing with it correctly? What happens if there is an exception inside your TContentHandler.Execute() method?

I recommend that you turn on session logging (ServerController.LogSessionEvents) so you can check what's the exact request you are receiving from the mobile browser
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)