B4J Library jServer v4.0 - Based on Jetty 11

Starting from B4J v9.80 this library is included as an internal library. Old library: https://www.b4x.com/android/forum/threads/141323/#content
This is a new version of jServer. It is based on Jetty 11. Previous versions were based on an early version of Jetty 9.
There were many improvements in Jetty during the last couple of years: https://github.com/eclipse/jetty.project/releases

It requires Java 11+.
It works with the standalone packager with these declarations:
B4X:
#PackagerProperty: AdditionalModuleInfoString = provides org.slf4j.spi.SLF4JServiceProvider with org.eclipse.jetty.logging.JettyLoggingServiceProvider;
#PackagerProperty: AdditionalModuleInfoString = provides org.eclipse.jetty.io.ssl.ALPNProcessor.Server with org.eclipse.jetty.alpn.java.server.JDK9ServerALPNProcessor;
#PackagerProperty: AdditionalModuleInfoString = provides org.eclipse.jetty.http.HttpFieldPreEncoder with org.eclipse.jetty.http2.hpack.HpackFieldPreEncoder, org.eclipse.jetty.http.Http1FieldPreEncoder;
#PackagerProperty: AdditionalModuleInfoString = uses org.eclipse.jetty.util.security.CredentialProvider;
#PackagerProperty: AdditionalModuleInfoString = uses org.eclipse.jetty.io.ssl.ALPNProcessor.Server;
#PackagerProperty: IncludedModules = jdk.charsets, jdk.crypto.ec
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, www temp\build\bin\www /E

Note that http sessions are not created automatically for WebSockets. You can use this filter handler to create it: https://www.b4x.com/android/forum/threads/safari-session-variables-in-b4j-v4.61652/post-389898 (apparently it relied on a feature not supported by WebSocket specs).

b4j_ws.js v0.93 is attached. It includes a fix suggested by @alwaysbusy: https://www.b4x.com/android/forum/threads/jserver-v4-0-based-on-jetty-11.140437/post-889892

Updates:
- v4.10 (beta) - dependencies updated with Jetty 11.0.26. Download link: https://www.b4x.com/b4j/files/jserver_4_10.zip
- v4.03 - suppresses the stack trace logs for ClosedChannelExceptions, which can happen sporadically on disconnections.
 

Attachments

  • b4j_ws.zip
    1.3 KB · Views: 1,511
Last edited:

a.consorti

Member
Licensed User
Hi, how can i use 4.0.3 wrapper for jServer.
I have a strange error that even ChatGPT can't resolve.
Even if I don't write any resp and I use resp.SendRedirect inside a Wait For Job I get error 500 and I'am very frustrated that I can't resolve this error.
I'm trying to autenticate on Azure and I have this error on callback url
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
- v4.10 (beta) - dependencies updated with Jetty 11.0.26. Download link: https://www.b4x.com/b4j/files/jserver_4_10.zip

The zip file includes jServer.jar/xml which should be in the internal libraries folder, and it includes a jserver folder that should replace the existing one (you can leave the old files there if want to switch back to previous version).

The update passed all my tests and I'm running it with several servers, including this one: https://b4x.com:51041/
Still, this is a large update regarding the many dependencies so I consider it a beta version for now.

Note that c3p0 jars now reside in the jserver folder.
 

Chris2

Active Member
Licensed User
Longtime User
Any plans to similarly update jWebsocketClient V2 ?

Given that Jetty 11 is EOL (notwithstanding the sponsored realeases), any plans to update everything to Jetty 12?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Updated XML for jWebSocketClient (v2.10) is attached. It depends on Jetty 11.0.26 (see previous post). It will be included as an internal library in the next update of B4J.

Given that Jetty 11 is EOL (notwithstanding the sponsered realeases), any plans to update everything to Jetty 12?
Yes, but not immediately. Jetty is a very mature framework. Many developers still use Jetty 9 and 10 (BTW, Jetty 12 requires Java 17+ which is also not ideal at this point).
 

Attachments

  • jWebSocketClient.xml
    4.3 KB · Views: 8

Jmu5667

Well-Known Member
Licensed User
Longtime User
Updated XML for jWebSocketClient (v2.10) is attached. It depends on Jetty 11.0.26 (see previous post). It will be included as an internal library in the next update of B4J.


Yes, but not immediately. Jetty is a very mature framework. Many developers still use Jetty 9 and 10 (BTW, Jetty 12 requires Java 17+ which is also not ideal at this point).
@tchart
 
Top