Skip to content

Commit f1deced

Browse files
committed
Updated to JakartaEE 9
1 parent 85e0272 commit f1deced

28 files changed

+181
-58
lines changed

as2-demo-spring-boot/pom.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
</dependency>
7171

7272
<dependency>
73-
<groupId>javax.servlet</groupId>
74-
<artifactId>javax.servlet-api</artifactId>
73+
<groupId>jakarta.servlet</groupId>
74+
<artifactId>jakarta.servlet-api</artifactId>
7575
<scope>provided</scope>
7676
</dependency>
7777

@@ -84,6 +84,14 @@
8484

8585
<build>
8686
<plugins>
87+
<plugin>
88+
<groupId>org.apache.maven.plugins</groupId>
89+
<artifactId>maven-compiler-plugin</artifactId>
90+
<configuration>
91+
<source>17</source>
92+
<target>17</target>
93+
</configuration>
94+
</plugin>
8795
<plugin>
8896
<groupId>org.springframework.boot</groupId>
8997
<artifactId>spring-boot-maven-plugin</artifactId>

as2-demo-spring-boot/src/main/java/com/helger/as2demo/springboot/As2SandboxApplication.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,16 @@
1717
*/
1818
package com.helger.as2demo.springboot;
1919

20-
import javax.servlet.ServletContextEvent;
21-
import javax.servlet.ServletContextListener;
22-
2320
import org.springframework.boot.SpringApplication;
2421
import org.springframework.boot.autoconfigure.SpringBootApplication;
25-
26-
import com.helger.as2servlet.AS2WebAppListener;
22+
import org.springframework.context.annotation.ComponentScan;
2723

2824
@SpringBootApplication
29-
public class As2SandboxApplication implements ServletContextListener
25+
@ComponentScan
26+
public class As2SandboxApplication
3027
{
3128
public static void main (final String [] args)
3229
{
3330
SpringApplication.run (As2SandboxApplication.class, args);
3431
}
35-
36-
@Override
37-
public void contextDestroyed (final ServletContextEvent sce)
38-
{
39-
ServletConfig.shutDown ();
40-
AS2WebAppListener.staticDestroy ();
41-
}
4232
}

as2-demo-spring-boot/src/main/java/com/helger/as2demo/springboot/ServletConfig.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020
import java.io.File;
2121

2222
import javax.annotation.OverridingMethodsMustInvokeSuper;
23-
import javax.servlet.ServletContext;
24-
import javax.servlet.ServletException;
2523

2624
import org.springframework.beans.factory.annotation.Autowired;
2725
import org.springframework.boot.web.servlet.ServletRegistrationBean;
2826
import org.springframework.context.annotation.Bean;
2927
import org.springframework.context.annotation.Configuration;
28+
import org.springframework.stereotype.Component;
3029

3130
import com.helger.as2lib.exception.AS2Exception;
3231
import com.helger.as2lib.session.AS2ComponentNotFoundException;
@@ -39,6 +38,10 @@
3938
import com.helger.web.scope.mgr.WebScopeManager;
4039
import com.helger.xservlet.AbstractXServlet;
4140

41+
import jakarta.annotation.PreDestroy;
42+
import jakarta.servlet.ServletContext;
43+
import jakarta.servlet.ServletException;
44+
4245
@Configuration
4346
public class ServletConfig
4447
{
@@ -139,4 +142,21 @@ public static void shutDown ()
139142
// we don't care on shut down
140143
}
141144
}
145+
146+
@Component
147+
public static class As2Cleanup
148+
{
149+
@PreDestroy
150+
public void onShutdown ()
151+
{
152+
ServletConfig.shutDown ();
153+
AS2WebAppListener.staticDestroy ();
154+
}
155+
}
156+
157+
@Bean
158+
public As2Cleanup cleanUpBean ()
159+
{
160+
return new As2Cleanup ();
161+
}
142162
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2018-2023 Philip Helger (www.helger.com)
3+
* philip[at]helger[dot]com
4+
* Idea by: Sergey Yaskov
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package com.helger.as2demo.springboot;
19+
20+
import org.junit.jupiter.api.Test;
21+
import org.springframework.boot.test.context.SpringBootTest;
22+
23+
@SpringBootTest
24+
class As2SpringbootApplicationTests
25+
{
26+
@Test
27+
void testContextLoads ()
28+
{}
29+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (C) 2018-2023 Philip Helger (www.helger.com)
3+
* philip[at]helger[dot]com
4+
* Idea by: Sergey Yaskov
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package com.helger.as2demo.springboot;
19+
20+
import org.junit.jupiter.api.Test;
21+
22+
import com.helger.commons.mock.SPITestHelper;
23+
24+
/**
25+
* Test SPI definitions
26+
*
27+
* @author Philip Helger
28+
*/
29+
public final class SPITest
30+
{
31+
@Test
32+
public void testBasic () throws Exception
33+
{
34+
SPITestHelper.testIfAllSPIImplementationsAreValid ();
35+
}
36+
}

as2-demo-webapp/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
</dependency>
5555

5656
<dependency>
57-
<groupId>javax.servlet</groupId>
58-
<artifactId>javax.servlet-api</artifactId>
57+
<groupId>jakarta.servlet</groupId>
58+
<artifactId>jakarta.servlet-api</artifactId>
5959
<scope>provided</scope>
6060
</dependency>
6161

as2-demo-webapp/src/main/java/com/helger/as2/webapp/servlet/AS2MDNReceiveServlet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
package com.helger.as2.webapp.servlet;
1818

1919
import javax.annotation.OverridingMethodsMustInvokeSuper;
20-
import javax.servlet.ServletException;
2120

2221
import com.helger.as2servlet.mdn.AS2MDNReceiveXServletHandlerConstantSession;
2322
import com.helger.commons.http.EHttpMethod;
2423
import com.helger.xservlet.AbstractXServlet;
2524

25+
import jakarta.servlet.ServletException;
26+
2627
/**
2728
* This is the main servlet that takes async AS2 MDN messages and processes
2829
* them. This servlet is configured to accept only POST requests. The logic for

as2-demo-webapp/src/main/java/com/helger/as2/webapp/servlet/AS2ReceiveServlet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
package com.helger.as2.webapp.servlet;
1818

1919
import javax.annotation.OverridingMethodsMustInvokeSuper;
20-
import javax.servlet.ServletException;
2120

2221
import com.helger.as2servlet.AS2ReceiveXServletHandlerConstantSession;
2322
import com.helger.commons.http.EHttpMethod;
2423
import com.helger.xservlet.AbstractXServlet;
2524

25+
import jakarta.servlet.ServletException;
26+
2627
/**
2728
* This is the main servlet that takes AS2 messages and processes them. This
2829
* servlet is configured to accept only POST requests. The logic for receiving

as2-demo-webapp/src/main/java/com/helger/as2/webapp/servlet/AS2WebAppListener.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
package com.helger.as2.webapp.servlet;
1818

1919
import javax.annotation.Nonnull;
20-
import javax.servlet.ServletContext;
21-
import javax.servlet.ServletContextEvent;
22-
import javax.servlet.ServletContextListener;
2320

2421
import com.helger.web.scope.mgr.WebScopeManager;
2522

23+
import jakarta.servlet.ServletContext;
24+
import jakarta.servlet.ServletContextEvent;
25+
import jakarta.servlet.ServletContextListener;
26+
2627
/**
2728
* A very simple listener, specifically modified for this demo application. Use
2829
* this as a &lt;listener&gt; in your <code>web.xml</code>.

as2-lib/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
<dependency>
8080
<groupId>org.bouncycastle</groupId>
8181
<artifactId>bcjmail-jdk18on</artifactId>
82-
<version>1.72</version>
8382
</dependency>
8483
<dependency>
8584
<groupId>org.apache.httpcomponents.client5</groupId>

0 commit comments

Comments
 (0)