Skip to content

Commit 5c81c65

Browse files
committed
migrate from Java EE to Jakarta EE
1 parent 95acad2 commit 5c81c65

File tree

7 files changed

+271
-311
lines changed

7 files changed

+271
-311
lines changed

ask-sdk-servlet-support/pom.xml

Lines changed: 139 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,146 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<parent>
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>com.amazon.alexa</groupId>
6+
<artifactId>ask-sdk-pom</artifactId>
7+
<version>2.86.0</version>
8+
</parent>
59
<groupId>com.amazon.alexa</groupId>
6-
<artifactId>ask-sdk-pom</artifactId>
10+
<artifactId>ask-sdk-servlet-support</artifactId>
11+
<packaging>jar</packaging>
712
<version>2.86.0</version>
8-
</parent>
9-
<groupId>com.amazon.alexa</groupId>
10-
<artifactId>ask-sdk-servlet-support</artifactId>
11-
<packaging>jar</packaging>
12-
<version>2.86.0</version>
13-
<name>ASK SDK for Java Servlet Support Plugin</name>
14-
<description>Contains supporting components for hosting a skill on a Servlet with the ASK SDK for Java.</description>
15-
<url>http://developer.amazon.com/ask</url>
16-
<licenses>
17-
<license>
18-
<name>The Apache License, Version 2.0</name>
19-
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
20-
</license>
21-
</licenses>
22-
<developers>
23-
<developer>
24-
<name>Alexa Skills Kit</name>
25-
<email>[email protected]</email>
26-
<organization>Alexa</organization>
27-
<organizationUrl>http://developer.amazon.com/ask</organizationUrl>
28-
</developer>
29-
</developers>
30-
<scm>
31-
<connection>scm:git:https://github.com/amzn/alexa-skills-kit-java.git</connection>
32-
<developerConnection>scm:git:https://github.com/amzn/alexa-skills-kit-java.git</developerConnection>
33-
<url>https://github.com/amzn/alexa-skills-kit-java.git</url>
34-
</scm>
13+
<name>ASK SDK for Java Servlet Support Plugin</name>
14+
<description>Contains supporting components for hosting a skill on a Servlet with the ASK SDK for Java.
15+
</description>
16+
<url>http://developer.amazon.com/ask</url>
17+
<licenses>
18+
<license>
19+
<name>The Apache License, Version 2.0</name>
20+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
</license>
22+
</licenses>
23+
<developers>
24+
<developer>
25+
<name>Alexa Skills Kit</name>
26+
<email>[email protected]</email>
27+
<organization>Alexa</organization>
28+
<organizationUrl>http://developer.amazon.com/ask</organizationUrl>
29+
</developer>
30+
</developers>
31+
<scm>
32+
<connection>scm:git:https://github.com/amzn/alexa-skills-kit-java.git</connection>
33+
<developerConnection>scm:git:https://github.com/amzn/alexa-skills-kit-java.git</developerConnection>
34+
<url>https://github.com/amzn/alexa-skills-kit-java.git</url>
35+
</scm>
3536

36-
<dependencies>
37-
<dependency>
38-
<groupId>com.amazon.alexa</groupId>
39-
<artifactId>ask-sdk-core</artifactId>
40-
<version>2.86.0</version>
41-
</dependency>
42-
<dependency>
43-
<groupId>javax.servlet</groupId>
44-
<artifactId>javax.servlet-api</artifactId>
45-
<version>3.0.1</version>
46-
<scope>provided</scope>
47-
</dependency>
48-
<dependency>
49-
<groupId>commons-codec</groupId>
50-
<artifactId>commons-codec</artifactId>
51-
<version>1.6</version>
52-
</dependency>
53-
<dependency>
54-
<groupId>commons-io</groupId>
55-
<artifactId>commons-io</artifactId>
56-
<version>2.7</version>
57-
</dependency>
58-
<dependency>
59-
<groupId>org.hamcrest</groupId>
60-
<artifactId>hamcrest-library</artifactId>
61-
<version>1.3</version>
62-
<scope>test</scope>
63-
</dependency>
64-
<dependency>
65-
<groupId>org.bouncycastle</groupId>
66-
<artifactId>bcprov-jdk15on</artifactId>
67-
<version>1.67</version>
68-
<scope>test</scope>
69-
</dependency>
70-
<dependency>
71-
<groupId>org.powermock</groupId>
72-
<artifactId>powermock-module-junit4</artifactId>
73-
<version>2.0.0</version>
74-
<scope>test</scope>
75-
</dependency>
76-
<dependency>
77-
<groupId>org.powermock</groupId>
78-
<artifactId>powermock-api-mockito2</artifactId>
79-
<version>2.0.0</version>
80-
<scope>test</scope>
81-
</dependency>
82-
<dependency>
83-
<groupId>junit</groupId>
84-
<artifactId>junit</artifactId>
85-
<version>4.13.1</version>
86-
<scope>test</scope>
87-
</dependency>
88-
<dependency>
89-
<groupId>org.slf4j</groupId>
90-
<artifactId>slf4j-api</artifactId>
91-
<version>1.7.10</version>
92-
</dependency>
93-
</dependencies>
37+
<dependencies>
38+
<dependency>
39+
<groupId>com.amazon.alexa</groupId>
40+
<artifactId>ask-sdk-core</artifactId>
41+
<version>2.86.0</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>jakarta.servlet</groupId>
45+
<artifactId>jakarta.servlet-api</artifactId>
46+
<version>6.0.0</version>
47+
<scope>provided</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>commons-codec</groupId>
51+
<artifactId>commons-codec</artifactId>
52+
<version>1.6</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>commons-io</groupId>
56+
<artifactId>commons-io</artifactId>
57+
<version>2.7</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.hamcrest</groupId>
61+
<artifactId>hamcrest-library</artifactId>
62+
<version>1.3</version>
63+
<scope>test</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.bouncycastle</groupId>
67+
<artifactId>bcprov-jdk15on</artifactId>
68+
<version>1.67</version>
69+
<scope>test</scope>
70+
</dependency>
71+
<dependency>
72+
<groupId>org.powermock</groupId>
73+
<artifactId>powermock-module-junit4</artifactId>
74+
<version>2.0.0</version>
75+
<scope>test</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>org.powermock</groupId>
79+
<artifactId>powermock-api-mockito2</artifactId>
80+
<version>2.0.0</version>
81+
<scope>test</scope>
82+
</dependency>
83+
<dependency>
84+
<groupId>junit</groupId>
85+
<artifactId>junit</artifactId>
86+
<version>4.13.1</version>
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.slf4j</groupId>
91+
<artifactId>slf4j-api</artifactId>
92+
<version>1.7.10</version>
93+
</dependency>
94+
</dependencies>
9495

95-
<build>
96-
<sourceDirectory>src</sourceDirectory>
97-
<testSourceDirectory>tst</testSourceDirectory>
98-
<pluginManagement>
99-
<plugins>
100-
<plugin>
101-
<groupId>org.apache.maven.plugins</groupId>
102-
<artifactId>maven-compiler-plugin</artifactId>
103-
<version>3.7.0</version>
104-
<configuration>
105-
<source>1.8</source>
106-
<target>1.8</target>
107-
<forceJavacCompilerUse>true</forceJavacCompilerUse>
108-
</configuration>
109-
</plugin>
110-
</plugins>
111-
</pluginManagement>
112-
</build>
113-
<profiles>
114-
<profile>
115-
<id>publishing</id>
116-
<build>
117-
<plugins>
96+
<build>
97+
<sourceDirectory>src</sourceDirectory>
98+
<testSourceDirectory>tst</testSourceDirectory>
99+
<pluginManagement>
100+
<plugins>
101+
<plugin>
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-compiler-plugin</artifactId>
104+
<version>3.7.0</version>
105+
<configuration>
106+
<source>1.8</source>
107+
<target>1.8</target>
108+
<forceJavacCompilerUse>true</forceJavacCompilerUse>
109+
</configuration>
110+
</plugin>
111+
</plugins>
112+
</pluginManagement>
113+
</build>
114+
<profiles>
115+
<profile>
116+
<id>publishing</id>
117+
<build>
118+
<plugins>
118119

119-
<plugin>
120-
<artifactId>maven-gpg-plugin</artifactId>
121-
<executions>
122-
<execution>
123-
<id>sign-artifacts</id>
124-
<phase>verify</phase>
125-
<goals>
126-
<goal>sign</goal>
127-
</goals>
128-
</execution>
129-
</executions>
130-
</plugin>
131-
<plugin>
132-
<groupId>org.sonatype.plugins</groupId>
133-
<artifactId>nexus-staging-maven-plugin</artifactId>
134-
<version>1.6.8</version>
135-
<extensions>true</extensions>
136-
<configuration>
137-
<serverId>sonatype-nexus-staging</serverId>
138-
<nexusUrl>https://oss.sonatype.org</nexusUrl>
139-
</configuration>
140-
</plugin>
141-
</plugins>
142-
</build>
143-
</profile>
144-
</profiles>
120+
<plugin>
121+
<artifactId>maven-gpg-plugin</artifactId>
122+
<executions>
123+
<execution>
124+
<id>sign-artifacts</id>
125+
<phase>verify</phase>
126+
<goals>
127+
<goal>sign</goal>
128+
</goals>
129+
</execution>
130+
</executions>
131+
</plugin>
132+
<plugin>
133+
<groupId>org.sonatype.plugins</groupId>
134+
<artifactId>nexus-staging-maven-plugin</artifactId>
135+
<version>1.6.8</version>
136+
<extensions>true</extensions>
137+
<configuration>
138+
<serverId>sonatype-nexus-staging</serverId>
139+
<nexusUrl>https://oss.sonatype.org</nexusUrl>
140+
</configuration>
141+
</plugin>
142+
</plugins>
143+
</build>
144+
</profile>
145+
</profiles>
145146
</project>

ask-sdk-servlet-support/src/com/amazon/ask/servlet/SkillServlet.java

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,27 @@
1313

1414
package com.amazon.ask.servlet;
1515

16-
import javax.servlet.http.HttpServlet;
17-
import javax.servlet.http.HttpServletRequest;
18-
import javax.servlet.http.HttpServletResponse;
19-
20-
import java.io.ByteArrayInputStream;
21-
import java.io.ByteArrayOutputStream;
22-
import java.io.InputStream;
23-
import java.io.IOException;
24-
import java.io.NotSerializableException;
25-
import java.io.ObjectInputStream;
26-
import java.io.ObjectOutputStream;
27-
import java.io.OutputStream;
28-
import java.net.Proxy;
29-
import java.util.ArrayList;
30-
import java.util.List;
31-
3216
import com.amazon.ask.Skill;
3317
import com.amazon.ask.exception.AskSdkException;
3418
import com.amazon.ask.model.RequestEnvelope;
3519
import com.amazon.ask.model.services.Serializer;
3620
import com.amazon.ask.request.impl.BaseSkillRequest;
3721
import com.amazon.ask.response.SkillResponse;
3822
import com.amazon.ask.servlet.util.ServletUtils;
39-
import com.amazon.ask.servlet.verifiers.AlexaHttpRequest;
40-
import com.amazon.ask.servlet.verifiers.ServletRequest;
41-
import com.amazon.ask.servlet.verifiers.SkillRequestSignatureVerifier;
42-
import com.amazon.ask.servlet.verifiers.SkillRequestTimestampVerifier;
43-
import com.amazon.ask.servlet.verifiers.SkillServletVerifier;
23+
import com.amazon.ask.servlet.verifiers.*;
4424
import com.amazon.ask.util.JacksonSerializer;
25+
import jakarta.servlet.http.HttpServlet;
26+
import jakarta.servlet.http.HttpServletRequest;
27+
import jakarta.servlet.http.HttpServletResponse;
4528
import org.apache.commons.io.IOUtils;
4629
import org.slf4j.Logger;
4730
import org.slf4j.LoggerFactory;
4831

32+
import java.io.*;
33+
import java.net.Proxy;
34+
import java.util.ArrayList;
35+
import java.util.List;
36+
4937
import static com.amazon.ask.servlet.ServletConstants.DEFAULT_TOLERANCE_MILLIS;
5038

5139
/**
@@ -58,7 +46,6 @@
5846
* invocation of the right method of the provided {@code Skill} . It also handles sending back
5947
* modified session attributes, user attributes and authentication tokens when needed and handles
6048
* exception cases.
61-
*
6249
*/
6350
public class SkillServlet extends HttpServlet {
6451
/**
@@ -90,6 +77,7 @@ public class SkillServlet extends HttpServlet {
9077

9178
/**
9279
* Constructor to build an instance of SkillServlet.
80+
*
9381
* @param skill an Alexa skill instance.
9482
*/
9583
public SkillServlet(final Skill skill) {
@@ -106,7 +94,8 @@ public SkillServlet(final Skill skill) {
10694

10795
/**
10896
* Constructor to build an instance of SkillServlet.
109-
* @param skill instance of {@link Skill}.
97+
*
98+
* @param skill instance of {@link Skill}.
11099
* @param verifiers list of {@link SkillServletVerifier}.
111100
*/
112101
SkillServlet(final Skill skill, final List<SkillServletVerifier> verifiers) {
@@ -166,7 +155,7 @@ protected void doPost(final HttpServletRequest request, final HttpServletRespons
166155
* {@code SkillServlet} determines the type of request and passes the request to
167156
* the configured {@code Skill}.
168157
*
169-
* @param input - input stream of the request.
158+
* @param input - input stream of the request.
170159
* @param output - output stream of the response.
171160
* @throws IOException if an input or output error is detected when the servlet handles the request
172161
*/
@@ -198,8 +187,9 @@ public void setProxy(final Proxy proxy) {
198187

199188
/**
200189
* Method throws an {@link NotSerializableException} if the servlet is not serializable.
190+
*
201191
* @param in instance of {@link ObjectInputStream}.
202-
* @throws IOException I/O exception.
192+
* @throws IOException I/O exception.
203193
* @throws ClassNotFoundException cannot a class through its fully-qualified name and can not find its definition on the classpath.
204194
*/
205195
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
@@ -208,6 +198,7 @@ private void readObject(final ObjectInputStream in) throws IOException, ClassNot
208198

209199
/**
210200
* Method throws an {@link NotSerializableException} if the servlet is not serializable.
201+
*
211202
* @param out instance of {@link ObjectOutputStream}.
212203
* @throws IOException I/O exception.
213204
*/

0 commit comments

Comments
 (0)