Skip to content

Commit 7584429

Browse files
committed
适配最新版
1 parent e515c62 commit 7584429

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

frameworks/Java/smart-socket/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<maven.compiler.source>21</maven.compiler.source>
1212
<maven.compiler.target>21</maven.compiler.target>
1313
<log4j.version>2.17.1</log4j.version>
14-
<smartservlet.version>1.5-SNAPSHOT</smartservlet.version>
14+
<smartservlet.version>2.3</smartservlet.version>
1515
<hikaricp.version>5.0.0</hikaricp.version>
1616
<jsoniter.version>0.9.23</jsoniter.version>
1717
</properties>
@@ -23,7 +23,7 @@
2323
<version>0.1-SNAPSHOT</version>
2424
</dependency>
2525
<dependency>
26-
<groupId>org.smartboot.servlet</groupId>
26+
<groupId>tech.smartboot.servlet</groupId>
2727
<artifactId>servlet-core</artifactId>
2828
<version>${smartservlet.version}</version>
2929
</dependency>

frameworks/Java/smart-socket/src/main/java/org/smartboot/http/JsonUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import com.jsoniter.output.JsonStreamPool;
55
import com.jsoniter.spi.JsonException;
66
import com.jsoniter.spi.Slice;
7+
import jakarta.servlet.http.HttpServletResponse;
78
import org.smartboot.http.server.HttpResponse;
89

9-
import javax.servlet.http.HttpServletResponse;
1010
import java.io.IOException;
1111

1212
/**

frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package org.smartboot.servlet;
22

3+
34
import org.smartboot.http.server.HttpBootstrap;
45
import org.smartboot.http.server.HttpRequest;
56
import org.smartboot.http.server.HttpResponse;
67
import org.smartboot.http.server.HttpServerHandler;
7-
import org.smartboot.servlet.conf.ServletInfo;
8+
import tech.smartboot.servlet.Container;
9+
import tech.smartboot.servlet.ServletContextRuntime;
10+
import tech.smartboot.servlet.conf.ServletInfo;
11+
import tech.smartboot.servlet.conf.ServletMappingInfo;
812

913
import java.util.concurrent.CompletableFuture;
1014

@@ -15,7 +19,7 @@
1519
public class Bootstrap {
1620

1721
public static void main(String[] args) throws Throwable {
18-
ContainerRuntime containerRuntime = new ContainerRuntime();
22+
Container containerRuntime = new Container();
1923
// plaintext
2024
ServletContextRuntime applicationRuntime = new ServletContextRuntime(null, Thread.currentThread().getContextClassLoader(), "/");
2125
applicationRuntime.setVendorProvider(response -> {
@@ -24,15 +28,15 @@ public static void main(String[] args) throws Throwable {
2428
ServletInfo plainTextServletInfo = new ServletInfo();
2529
plainTextServletInfo.setServletName("plaintext");
2630
plainTextServletInfo.setServletClass(HelloWorldServlet.class.getName());
27-
plainTextServletInfo.addMapping("/plaintext");
31+
applicationRuntime.getDeploymentInfo().addServletMapping(new ServletMappingInfo(plainTextServletInfo.getServletName(), "/plaintext"));
2832
applicationRuntime.getDeploymentInfo().addServlet(plainTextServletInfo);
2933

3034
// json
3135
ServletInfo jsonServletInfo = new ServletInfo();
3236
jsonServletInfo.setServletName("json");
3337
jsonServletInfo.setServletClass(JsonServlet.class.getName());
34-
jsonServletInfo.addMapping("/json");
3538
applicationRuntime.getDeploymentInfo().addServlet(jsonServletInfo);
39+
applicationRuntime.getDeploymentInfo().addServletMapping(new ServletMappingInfo(jsonServletInfo.getServletName(), "/json"));
3640
containerRuntime.addRuntime(applicationRuntime);
3741

3842
int cpuNum = Runtime.getRuntime().availableProcessors();

frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/HelloWorldServlet.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package org.smartboot.servlet;
22

33

4-
import javax.servlet.ServletException;
5-
import javax.servlet.http.HttpServlet;
6-
import javax.servlet.http.HttpServletRequest;
7-
import javax.servlet.http.HttpServletResponse;
4+
import jakarta.servlet.ServletException;
5+
import jakarta.servlet.http.HttpServlet;
6+
import jakarta.servlet.http.HttpServletRequest;
7+
import jakarta.servlet.http.HttpServletResponse;
8+
89
import java.io.IOException;
910

1011
/**

frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/JsonServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.smartboot.servlet;
22

3+
import jakarta.servlet.ServletException;
4+
import jakarta.servlet.http.HttpServlet;
5+
import jakarta.servlet.http.HttpServletRequest;
6+
import jakarta.servlet.http.HttpServletResponse;
37
import org.smartboot.Message;
48
import org.smartboot.http.JsonUtil;
59

6-
import javax.servlet.ServletException;
7-
import javax.servlet.http.HttpServlet;
8-
import javax.servlet.http.HttpServletRequest;
9-
import javax.servlet.http.HttpServletResponse;
1010
import java.io.IOException;
1111

1212
/**

0 commit comments

Comments
 (0)