B4J Question Final request url after redirects needed (okHttpUtils) [SOLVED]

mc73

Well-Known Member
Licensed User
Longtime User
I need to get the url of the final redirect request cause it contains some variables needed for further actions needed, and which unfortunately are not included in the headers, and of course the location header is null.
I found this:
B4X:
response.request().urlString();
, but if I try to insert this, using jo, I get
B4X:
java.lang.RuntimeException: Method: request not found in: anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpResponse
.
What may be the correct way of getting the url?
Thank you.
 

mc73

Well-Known Member
Licensed User
Longtime User
Thank you, Erel, but there is no such field as response in httpHob. Any other way?

B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("http://www.b4x.com")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
   Dim jo As JavaObject = j.Response
   Dim url As String = jo.GetFieldJO("response").RunMethodJO("request", Null).RunMethod("url", Null)
End If
 
Upvote 0
Top