Consider to use PostBytes ?
B4X:Dim stream() As Byte = File.ReadBytes(File.DirAssets, "file.pdf") job.PostBytes(Link, stream)
Interesting, but how to obtain the post from web server jetty version 7?
Public Sub PostStreamBytes As HttpResponseMessage
Try
Dim tmp As String = File.Combine(Main.srvr.StaticFilesFolder, "tmp")
Dim ins As InputStream = Request.InputStream
Dim out As OutputStream = File.OpenOutput(tmp, "upload.pdf", False)
File.Copy2(ins, out)
out.Close
HRM.ResponseCode = 200
Catch
Log(LastException)
HRM.ResponseCode = 400
HRM.ResponseError = "Error Input Stream"
End Try
Return HRM
End Sub
I am not sure about Jetty 7.web server jetty version 7
I am not sure about Jetty 7.
As far as I know, we only have the following libraries:
jServer2 and jServer3 based on Jetty 9
and
jServer4 based on Jetty 11
Dim sNameFileUploated As String = Request.GetUploadedFile(<key_name_fields_uploaded>)
'open the temporary file.
Dim oInputStream As InputStream
oInputStream = File.OpenInput(serverHTTP.TempFolder, sNameFileUploated)
HttpServer was built before B4J was available and especially before jServer was available. Real servers should be built with jServer.
I don't recommend using HttpServer.
This is a mistake to use HttpServer to build a client / server solution. There are much better options such as MQTT.
GetInputStream As InputStream
Oh, you are referring to B4A HttpServer created in 2013
Embed an Http Server in your Android Application
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
If you insist, I think this library supports
B4X:GetInputStream As InputStream
[B4X] xHttpServer (Http Server + jQuery)
It is a personal project of mine that I started as a hobby on B4i and it has become an interesting project, so that I have modified it to be multiplatform. It is an http server, which allows a browser to navigate on html pages stored on the device. In addition, dynamic pages can also be...www.b4x.com
Oh, you are referring to B4A HttpServer created in 2013
Embed an Http Server in your Android Application
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
If you insist, I think this library supports
B4X:GetInputStream As InputStream
[B4X] xHttpServer (Http Server + jQuery)
It is a personal project of mine that I started as a hobby on B4i and it has become an interesting project, so that I have modified it to be multiplatform. It is an http server, which allows a browser to navigate on html pages stored on the device. In addition, dynamic pages can also be...www.b4x.com
//Returns the HTTP method (GET or POST).
public String getMethod()
// Returns the request URL without the host and any parameters.
public String getRequestURI()
// Returns the client IP address.
public String getRemoteAddress()
// Returns the parameter value or an empty string if the parameter does not exist.
public String GetParameter(String Name)
// Returns the name of the temporary file that was uploaded to Server.TempFolder.
public String GetUploadedFile(String Key)
Sorry, I couldn't answer your question as I am not familiar with both libraries.Is the compatibility of the "HttpServer" library with the new "jServer" libraries supported, in your opinion?