Browse Source

rename handle (#6626)

* update smart-servlet to 0.1.3-SNAPSHOT

* update aio-enhance to 1.0.3-SNAPSHOT

* smart-servlet bugfix

* bugfix

* update smart-socket to 1.5.6-SNAPSHOT

* remove file

* update aio-enhance to 1.0.4-SNAPSHOT

* 优化代码

* 优化代码

* update smart-socket to 1.5.6

* config threadNum

* update smart-socket to 1.5.7-SNAPSHOT

* 优化代码

* update smart-socket to 1.5.10-SNAPSHOT

* 优化代码

* 优化代码

* 优化代码
三刀 4 years ago
parent
commit
3946b330ed

+ 8 - 8
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java

@@ -15,8 +15,8 @@ import org.smartboot.aio.EnhanceAsynchronousChannelProvider;
 import org.smartboot.http.server.HttpBootstrap;
 import org.smartboot.http.server.HttpRequest;
 import org.smartboot.http.server.HttpResponse;
-import org.smartboot.http.server.HttpServerHandle;
-import org.smartboot.http.server.handle.HttpRouteHandle;
+import org.smartboot.http.server.HttpServerHandler;
+import org.smartboot.http.server.handler.HttpRouteHandler;
 import org.smartboot.http.server.impl.Request;
 import org.smartboot.socket.StateMachineEnum;
 import org.smartboot.socket.extension.processor.AbstractMessageProcessor;
@@ -31,22 +31,22 @@ public class Bootstrap {
     public static void main(String[] args) {
         System.setProperty("java.nio.channels.spi.AsynchronousChannelProvider", EnhanceAsynchronousChannelProvider.class.getName());
 
-        HttpRouteHandle routeHandle = new HttpRouteHandle();
+        HttpRouteHandler routeHandle = new HttpRouteHandler();
         routeHandle
-                .route("/plaintext", new HttpServerHandle() {
+                .route("/plaintext", new HttpServerHandler() {
 
 
                     @Override
-                    public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
+                    public void handle(HttpRequest request, HttpResponse response) throws IOException {
                         response.setContentLength(body.length);
                         response.setContentType("text/plain; charset=UTF-8");
                         response.write(body);
                     }
                 })
-                .route("/json", new HttpServerHandle() {
+                .route("/json", new HttpServerHandler() {
 
                     @Override
-                    public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
+                    public void handle(HttpRequest request, HttpResponse response) throws IOException {
 
                         response.setContentType("application/json");
                         JsonUtil.writeJsonBytes(response, new Message("Hello, World!"));
@@ -76,7 +76,7 @@ public class Bootstrap {
         bootstrap.pipeline(routeHandle).setPort(8080).start();
     }
 
-    private static void initDB(HttpRouteHandle routeHandle) {
+    private static void initDB(HttpRouteHandler routeHandle) {
         try {
             Class.forName("org.postgresql.Driver");
         } catch (ClassNotFoundException e) {

+ 3 - 3
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/MultipleQueriesHandler.java

@@ -3,7 +3,7 @@ package org.smartboot.http;
 import org.smartboot.http.common.utils.NumberUtils;
 import org.smartboot.http.server.HttpRequest;
 import org.smartboot.http.server.HttpResponse;
-import org.smartboot.http.server.HttpServerHandle;
+import org.smartboot.http.server.HttpServerHandler;
 
 import javax.sql.DataSource;
 import java.io.IOException;
@@ -17,7 +17,7 @@ import java.util.concurrent.ThreadLocalRandom;
  * @author 三刀
  * @version V1.0 , 2020/6/16
  */
-public class MultipleQueriesHandler extends HttpServerHandle {
+public class MultipleQueriesHandler extends HttpServerHandler {
     private DataSource dataSource;
 
     public MultipleQueriesHandler(DataSource dataSource) {
@@ -25,7 +25,7 @@ public class MultipleQueriesHandler extends HttpServerHandle {
     }
 
     @Override
-    public void doHandle(HttpRequest httpRequest, HttpResponse response) throws IOException {
+    public void handle(HttpRequest httpRequest, HttpResponse response) throws IOException {
         int queries = Math.min(Math.max(NumberUtils.toInt(httpRequest.getParameter("queries"), 1), 1), 500);
         World[] worlds = new World[queries];
         try (Connection connection = dataSource.getConnection();

+ 3 - 3
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/SingleQueryHandler.java

@@ -2,7 +2,7 @@ package org.smartboot.http;
 
 import org.smartboot.http.server.HttpRequest;
 import org.smartboot.http.server.HttpResponse;
-import org.smartboot.http.server.HttpServerHandle;
+import org.smartboot.http.server.HttpServerHandler;
 
 import javax.sql.DataSource;
 import java.io.IOException;
@@ -16,7 +16,7 @@ import java.util.concurrent.ThreadLocalRandom;
  * @author 三刀
  * @version V1.0 , 2020/6/16
  */
-public class SingleQueryHandler extends HttpServerHandle {
+public class SingleQueryHandler extends HttpServerHandler {
     private DataSource dataSource;
 
     public SingleQueryHandler(DataSource dataSource) {
@@ -24,7 +24,7 @@ public class SingleQueryHandler extends HttpServerHandle {
     }
 
     @Override
-    public void doHandle(HttpRequest httpRequest, HttpResponse response) throws IOException {
+    public void handle(HttpRequest httpRequest, HttpResponse response) throws IOException {
         World world = new World();
         try (Connection connection = dataSource.getConnection();
              PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM World WHERE id=?");) {

+ 3 - 3
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/UpdateHandler.java

@@ -3,7 +3,7 @@ package org.smartboot.http;
 import org.smartboot.http.common.utils.NumberUtils;
 import org.smartboot.http.server.HttpRequest;
 import org.smartboot.http.server.HttpResponse;
-import org.smartboot.http.server.HttpServerHandle;
+import org.smartboot.http.server.HttpServerHandler;
 
 import javax.sql.DataSource;
 import java.io.IOException;
@@ -18,7 +18,7 @@ import java.util.concurrent.ThreadLocalRandom;
  * @author 三刀
  * @version V1.0 , 2020/6/16
  */
-public class UpdateHandler extends HttpServerHandle {
+public class UpdateHandler extends HttpServerHandler {
     private DataSource dataSource;
 
     public UpdateHandler(DataSource dataSource) {
@@ -26,7 +26,7 @@ public class UpdateHandler extends HttpServerHandle {
     }
 
     @Override
-    public void doHandle(HttpRequest httpRequest, HttpResponse response) throws IOException {
+    public void handle(HttpRequest httpRequest, HttpResponse response) throws IOException {
         int queries = Math.min(Math.max(NumberUtils.toInt(httpRequest.getParameter("queries"), 1), 1), 500);
         World[] worlds = new World[queries];
         StringJoiner updateSql = new StringJoiner(

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

@@ -4,7 +4,7 @@ import org.smartboot.aio.EnhanceAsynchronousChannelProvider;
 import org.smartboot.http.server.HttpBootstrap;
 import org.smartboot.http.server.HttpRequest;
 import org.smartboot.http.server.HttpResponse;
-import org.smartboot.http.server.HttpServerHandle;
+import org.smartboot.http.server.HttpServerHandler;
 import org.smartboot.http.server.impl.Request;
 import org.smartboot.servlet.conf.ServletInfo;
 import org.smartboot.socket.StateMachineEnum;
@@ -61,9 +61,9 @@ public class Bootstrap {
                     }
                 });
         bootstrap.setPort(8080)
-                .pipeline(new HttpServerHandle() {
+                .pipeline(new HttpServerHandler() {
                     @Override
-                    public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
+                    public void handle(HttpRequest request, HttpResponse response) throws IOException {
                         containerRuntime.doHandle(request, response);
                     }
                 })