Skip to content

Commit 73524c8

Browse files
authored
Perform the jakarta EE migration (#414)
* Replace javax.servlet with jakarta.servlet * Move the jakarta.servlet related classes to a new package org.python.servlet * Move modjy's PyFilterTest and PyServletTest to their new package, too * Update NEWS
1 parent 3760bfb commit 73524c8

20 files changed

Lines changed: 71 additions & 59 deletions

File tree

Lib/modjy/modjy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import sys
2424
import types
2525

26-
sys.add_package("javax.servlet")
27-
sys.add_package("javax.servlet.http")
26+
sys.add_package("jakarta.servlet")
27+
sys.add_package("jakarta.servlet.http")
2828
sys.add_package("org.python.core")
2929

3030
from modjy_exceptions import *
@@ -35,7 +35,7 @@
3535
from modjy_impl import modjy_impl
3636
from modjy_publish import modjy_publisher
3737

38-
from javax.servlet.http import HttpServlet
38+
from jakarta.servlet.http import HttpServlet
3939

4040
class modjy_servlet(HttpServlet, modjy_publisher, modjy_wsgi, modjy_impl):
4141

Lib/modjy/modjy_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from java.lang import IllegalStateException
2626
from java.io import IOException
27-
from javax.servlet import ServletException
27+
from jakarta.servlet import ServletException
2828

2929
class ModjyException(Exception): pass
3030

Lib/test/pyservlet/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from javax.servlet.http import HttpServlet
1+
from jakarta.servlet.http import HttpServlet
22

33
class basic(HttpServlet):
44
def doGet(self, req, resp):

Lib/test/pyservlet/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from javax.servlet import Filter
1+
from jakarta.servlet import Filter
22

33
class filter(Filter):
44
def init(self, config):

Lib/test/pyservlet/increment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from javax.servlet.http import HttpServlet
1+
from jakarta.servlet.http import HttpServlet
22

33
class increment(HttpServlet):
44
def __init__(self):

Lib/test/pyservlet/updated_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from javax.servlet.http import HttpServlet
1+
from jakarta.servlet.http import HttpServlet
22

33
class basic(HttpServlet):
44
def doGet(self, req, resp):

NEWS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ Jython 2.7.5
1616

1717
New Features
1818

19+
- Servlet support is updated to use the jakarta namespace. As part of this
20+
change, the classes org.python.util.PyServlet, org.python.util.PyFilter
21+
and org.python.util.PyServletInitializer have been relocated to a new
22+
package org.python.servlet. Users should double-check that this change is
23+
adjusted in their config if necessary.
24+
The relocation allows adding the old classes (with javax.servlet imports)
25+
to the classpath on top of jython.jar without name conflict. In many cases
26+
this should suffice to retain workability of a legacy setup if needed.
27+
1928
Jython 2.7.5a1 Bugs fixed
29+
- [ GH-382 ] Java EE Servlet Namespace Has Been Changed From javax.servlet to jakarta.servlet
2030

2131

2232

b/.idea/libraries/extlibs.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ dependencies {
140140
* choose the latest required.
141141
*/
142142

143-
// Using a version available from repo (not 'extlibs/servlet-api-2.5' as in build.xml)
144-
implementation 'javax.servlet:javax.servlet-api:3.1.0'
143+
implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0'
145144

146145
/*
147146
* These seem to be unnecessary while the proprietary database support is

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ informix.jar = ../support/jdbc-4.10.12.jar
243243

244244
<!-- Further database and Java EE-related JARs -->
245245
<filelist dir="${extlibs.dir}">
246-
<file name="servlet-api-2.5.jar" />
246+
<file name="jakarta.servlet-api-5.0.0.jar" />
247247
<file name="mysql-connector-java-5.1.42-bin.jar" />
248248
<file name="postgresql-42.1.1.jre7.jar" />
249249
</filelist>
@@ -1259,7 +1259,7 @@ The text for an official release would continue like ...
12591259
<exclude name="extlibs/asm*.jar" />
12601260
<exclude name="extlibs/jarjar*.jar" />
12611261
<exclude name="extlibs/junit*.jar" />
1262-
<exclude name="extlibs/servlet-api*.jar" />
1262+
<exclude name="extlibs/jakarta.servlet-api-*.jar" />
12631263
<exclude name="extlibs/stringtemplate*.jar" />
12641264
<exclude name="extlibs/xerces*.jar" />
12651265
</fileset>

0 commit comments

Comments
 (0)