Hello Erel, I'm new to JavaFX Scene Builder, I tryed to follow exactly the tutorials but I'm facing to a strange (to me) problem.
I've the following code in the Upload Class from your FileServer, which was Not-UI. I wanted to have an UI so I created a new one with UI and copied and adapted yours.
I created txtUser and label1 with JavaFX Scene Builder. When I run the server nothing is sent to the txtUser or the Label1 which remain blank. But if I check the Watch pane on the bottom it looks it receives the text sent by the client side app: (TextField) TextField@2ae7a162[styleClass=text-input text-field], Text: mytextsent,.
Any idea on what I missed? thank you
I've the following code in the Upload Class from your FileServer, which was Not-UI. I wanted to have an UI so I created a new one with UI and copied and adapted yours.
B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
If req.Method <> "POST" Then
resp.SendError(500, "method not supported.")
Return
End If
'we need to call req.InputStream before calling GetParameter.
'Otherwise the stream will be read internally (as the parameter might be in the post body).
Dim In As InputStream = req.InputStream
Dim reqType As String = req.GetParameter("type")
If reqType = "" Then
resp.SendError(500, "Missing type parameter.")
Return
End If
Select reqType
Case "text"
Dim tr As TextReader
tr.Initialize(In)
txtUser.Initialize("mio")
Label1.TextColor = fx.Colors.Black
'Msgbox.Show (tr.ReadAll,"")
txtUser.Text = tr.Readall
'Label1.Text=tr.Readall
'tr.Initialize(In)
'Log("Received text message: " & CRLF & tr.ReadAll)
resp.Write("Message received successfully.")
Case "file"
Dim name As String = req.GetParameter("name")
Dim out As OutputStream = File.OpenOutput(Main.filesFolder, name, False)
File.Copy2(In, out)
out.Close
Log("Received file: " & name & ", size=" & File.Size(Main.filesFolder, name))
resp.Write("File received successfully.")
End Select
End Sub
I created txtUser and label1 with JavaFX Scene Builder. When I run the server nothing is sent to the txtUser or the Label1 which remain blank. But if I check the Watch pane on the bottom it looks it receives the text sent by the client side app: (TextField) TextField@2ae7a162[styleClass=text-input text-field], Text: mytextsent,.
Any idea on what I missed? thank you