Hello.
I have a problem.
I have the handler
The server reads in the format '' https: // localhost / get / username / password '
Based on the data from the link, a link is downloaded that downloads from another server via httpjob. When he wants to send via resp, no result.
How to solve it?
I have a problem.
I have the handler
B4X:
srvr.AddHandler ("/get/*", "link", False)
Based on the data from the link, a link is downloaded that downloads from another server via httpjob. When he wants to send via resp, no result.
How to solve it?
B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
Dim url As String = req.FullRequestURI
url = url.SubString(url.IndexOf("get/")+4)
Dim user As String = url.SubString2(0,url.IndexOf("/"))
Dim pass As String = url.SubString(url.IndexOf("/")+1)
Dim link As String = DBM.SQLSelectSingleResult("select link from table where user=? and pass=?", Array As String(user, pass))
If link.Length >10 Then
resp.Write("test1") '=> send OK
Dim j As HttpJob
j.Initialize("", Me)
j.Download(link)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
resp.Write("test2") '=> no send , webbrowser empty
Dim value As String = j.GetString
Log(value) => 'value is OK
resp.Write(value) ' => no send , webbrowser empty
j.Release
End If
Else
resp.Write("Bad :(")
End If
End Sub