The HttpServer library is a new library, based on an open source project named Jetty. This library allows you to easily embed an Http server in your application. Http server means that you can point a browser to the device IP address (and relevant port) and communicate with your app. It can be...
www.b4x.com
I am wondering how to read whatever is posted from the http job through the received ServletRequest.
So far I can only read header and url from the request. Where can I find the data from a http.poststring / http.postbytes method?
This example shows how to make your B4J server application accessible over the internet. The implemented server is a simple file server that allows you to upload files from your B4A application to the server over the internet. The following steps are required in order to make your server...
'prints the requests parameters
Public Sub PrintAllParameters (req As ServletRequest) As String
Dim sb As StringBuilder
sb.Initialize
sb.Append("<ul>")
Dim params As Map = req.ParameterMap
For Each name As String In params.Keys
sb.Append("<li>").Append(name).Append(":")
Dim values() As String = params.Get(name)
For Each value As String In values
sb.Append(" ").Append(value)
Next
sb.Append("</li>")
Next
sb.Append("</ul>")
Return sb.ToString
End Sub
This is from an b4j example found in the forum. It is using jserver.
I don´t know whether it works with b4a httpserver.
This example shows how to make your B4J server application accessible over the internet. The implemented server is a simple file server that allows you to upload files from your B4A application to the server over the internet. The following steps are required in order to make your server...
'prints the requests parameters
Public Sub PrintAllParameters (req As ServletRequest) As String
Dim sb As StringBuilder
sb.Initialize
sb.Append("<ul>")
Dim params As Map = req.ParameterMap
For Each name As String In params.Keys
sb.Append("<li>").Append(name).Append(":")
Dim values() As String = params.Get(name)
For Each value As String In values
sb.Append(" ").Append(value)
Next
sb.Append("</li>")
Next
sb.Append("</ul>")
Return sb.ToString
End Sub
This is from an b4j example found in the forum. It is using jserver.
I don´t know whether it works with b4a httpserver.
The getparameter method in B4A requires a key and hence only return a single value. No options for getting all names of existing parameters. ? That's why I am wondering what the default names of parameters for the http job are.
Why are you using HttpServer? The only relevant use case is if you want to interact with your app from the browser. There are much better and simpler solutions for general communication.
HttpServer supports two types of requests: GET requests and multipart POST requests. Nothing else.
If you want to build a real http server then switch to B4J.
Why are you using HttpServer? The only relevant use case is if you want to interact with your app from the browser. There are much better and simpler solutions for general communication.
HttpServer supports two types of requests: GET requests and multipart POST requests. Nothing else.
If you want to build a real http server then switch to B4J.
Why are you using HttpServer? The only relevant use case is if you want to interact with your app from the browser. There are much better and simpler solutions for general communication.
HttpServer supports two types of requests: GET requests and multipart POST requests. Nothing else.
If you want to build a real http server then switch to B4J.
Yes I know. but the thing is I dont know how to catch the POST content. I have tested with the library and see that the POST command works on the client app because I can see the change in content length. But there is no commands for reading the content.... So all the POST commands are meaningless because I cant read what is posted