B4i Library [class] HttpUtils2

fbritop

Well-Known Member
Licensed User
Longtime User
Erel,
What modification should be done to this class in order to accept invalid certificates from the server. I have done it in B4A but I cannot find what part to change in B4I

Thanks
FBP
 

melvin2345

Member
Licensed User
Longtime User
I'm trying to copy over a project from B4A, and one of the stumbling blocks I'm hitting is with httputils.

For example, in B4A I have
B4X:
HttpUtils.CallbackActivity = "Main"
HttpUtils.CallbackJobDoneSub = "DDVerDone"
HttpUtils.Download("JobV", DD_Version)

Sub DDVerDONE (Job As String)
    ShowLoading
  
    Dim DDVerString As InputStream
    If HttpUtils.IsSuccess(DD_Version) Then
        'Msgbox("Version Downloaded", "Version")
        DDVerString = HttpUtils.GetInputStream(DD_Version)
        DDData.ExecNonQuery("CREATE TABLE IF NOT EXISTS DDVersion (Version TEXT)")
        DDVParser.Parse(DDVerString, "VerParser")
    Else
        'Msgbox("Could not get version","VerUpdate")
        HideLoading
    End If
  
End Sub

B4i screams bloody murder on the HttpUtils calls. My question is, does the HttpUtils2 module for B4I allow for multiple custom "done" subs, or do i just need to check for the job in a single sub like this
B4X:
Sub JobDone (Job As HttpJob)
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
        Select Job.JobName
            Case "Job1", "Job2"
                'print the result to the logs
                Log(Job.GetString2("Windows-1252"))
            Case "Job3"
                'show the downloaded image
                ImageView1.Bitmap = Job.GetBitmap
        End Select
    Else
        Log("Error: " & Job.ErrorMessage)
        hd.ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
    Job.Release
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…