pippo icon indicating copy to clipboard operation
pippo copied to clipboard

Upgrade to Jakarta EE

Open gkresic opened this issue 2 years ago • 6 comments

This is an extension to #490 (first half of it, anyway). Over there it was proposed to to upgrade to servlet 4 spec, but nothing is said on javax -> jakarta namespace migration that is part of spec 4.

So I propose migration in 2 steps:

  1. migrate to Servlet 4 spec, but keep javax.servlet namespace
  2. switch namespace to jakarta.servlet (this will imply switching implementations, but all currently supported implementations supports this in parallel releases: Jetty 10/11, Tomcat 9/10 and Undertow with io.undertow:undertow-servlet-jakartaee9 dependency

If Pippo doesn't have to support parallel versions for JavaEE and JakartaEE, then those two steps could be squashed into one and leave JavaEE compatibility behind.

Depends on #613

gkresic avatar Feb 05 '23 18:02 gkresic

I may submit a pull request for this one, but would like first to clarify the strategy for getting there among the two described above.

Since Pippo 1.x supports javax namespace, it's stable and can be used in legacy apps as is, my suggestion would be to go with Pippo 2.x straight to jakarta namespace.

gkresic avatar Feb 14 '23 09:02 gkresic

my suggestion would be to go with Pippo 2.x straight to jakarta namespace

I agree.

decebals avatar Feb 14 '23 12:02 decebals

Working on it and I'm almost done, but have one question.

Due to the changes in the way Jetty handles WebSockets, I need an access to Jetty Server instance from within JettyWebSocketFilter.init

What would be the best was to access it from there? Provided FilterConfig does not hold any reference to Server.

gkresic avatar Feb 16 '23 19:02 gkresic

Here's my work so far:

https://github.com/gkresic/pippo/tree/jakarta

Notice hardcoded server access in ro.pippo.jetty.websocket.JettyWebSocketFilter: https://github.com/gkresic/pippo/blob/jakarta/pippo-server-parent/pippo-jetty/src/main/java/ro/pippo/jetty/websocket/JettyWebSocketFilter.java

Tests confirm that WebSocket endpoints are working.

Unrelated, notice that my initial assumptions about servlet versions were incorrect: servlet specs 4 and 5 are the same, only difference being javax/jakarta namespace difference. So this, when implemented will move Pippo to servlet version 5 spec. Version 6 will have to wait until Jetty 12 (currently in alpha) since it's the only server of three (Jetty/Tomcat/Undertow) that doesn't support v6.

gkresic avatar Feb 17 '23 13:02 gkresic

@gkresic When you have something functional please create a PR fore review and comments. It's more easy to compare the impact of the changes using the diffs view.

decebals avatar Feb 21 '23 13:02 decebals

Created WIP PR #639

gkresic avatar Feb 21 '23 18:02 gkresic