Explorar el Código

update to 1.0.1 (#4014)

* smart-socket 1.0

* smart-socket 1.0

* smart-socket 1.0.1

* smart-socket 1.0.1

* smart-socket 1.0.1
三刀 hace 7 años
padre
commit
5a0c0b7f44

+ 1 - 1
frameworks/Java/smart-socket/pom.xml

@@ -9,7 +9,7 @@
     <parent>
         <groupId>org.smartboot.http</groupId>
         <artifactId>smart-http-parent</artifactId>
-        <version>1.0.0</version>
+        <version>1.0.1</version>
     </parent>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

+ 1 - 1
frameworks/Java/smart-socket/smart-socket.dockerfile

@@ -7,4 +7,4 @@ RUN mvn compile assembly:single
 FROM openjdk:10-jre-slim
 WORKDIR /smart-socket
 COPY --from=maven /smart-socket/target/smart-socket-benchmark-1.0-jar-with-dependencies.jar app.jar
-CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-cp", "app.jar", "org.smartboot.http.HttpBootstrap"]
+CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-cp", "app.jar", "org.smartboot.http.Bootstrap"]

+ 10 - 11
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/HttpBootstrap.java → frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java

@@ -8,26 +8,26 @@
 
 package org.smartboot.http;
 
-import org.smartboot.http.common.HttpEntityV2;
-import org.smartboot.http.common.HttpRequestProtocol;
-import org.smartboot.http.common.utils.HttpHeaderConstant;
 import org.smartboot.http.server.handle.HttpHandle;
-import org.smartboot.http.server.http11.HttpResponse;
+import org.smartboot.http.server.v1.HttpMessageProcessor;
+import org.smartboot.http.server.v1.decode.HttpEntity;
+import org.smartboot.http.server.v1.decode.HttpRequestProtocol;
+import org.smartboot.http.utils.HttpHeaderConstant;
 import org.smartboot.socket.MessageProcessor;
 import org.smartboot.socket.transport.AioQuickServer;
 
 import java.io.IOException;
 
-public class HttpBootstrap {
+public class Bootstrap {
     static byte[] body = "Hello, World!".getBytes();
 
     public static void main(String[] args) {
-        org.smartboot.http.server.HttpV2MessageProcessor processor = new org.smartboot.http.server.HttpV2MessageProcessor(System.getProperty("webapps.dir", "./"));
+        HttpMessageProcessor processor = new HttpMessageProcessor(System.getProperty("webapps.dir", "./"));
         processor.route("/plaintext", new HttpHandle() {
 
 
             @Override
-            public void doHandle(HttpEntityV2 request, HttpResponse response) throws IOException {
+            public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
 
                 response.setHeader(HttpHeaderConstant.Names.CONTENT_LENGTH, body.length + "");
                 response.setHeader(HttpHeaderConstant.Names.CONTENT_TYPE, "text/plain; charset=UTF-8");
@@ -36,7 +36,7 @@ public class HttpBootstrap {
         });
         processor.route("/json", new HttpHandle() {
             @Override
-            public void doHandle(HttpEntityV2 request, HttpResponse response) throws IOException {
+            public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
                 byte[] b = JSON.toJson(new Message("Hello, World!"));
                 response.setHeader(HttpHeaderConstant.Names.CONTENT_LENGTH, b.length + "");
                 response.setHeader(HttpHeaderConstant.Names.CONTENT_TYPE, "application/json");
@@ -47,12 +47,11 @@ public class HttpBootstrap {
 //        https(processor);
     }
 
-    public static void http(MessageProcessor<org.smartboot.http.common.HttpEntityV2> processor) {
+    public static void http(MessageProcessor<HttpEntity> processor) {
         // 定义服务器接受的消息类型以及各类消息对应的处理器
-        AioQuickServer<org.smartboot.http.common.HttpEntityV2> server = new AioQuickServer<org.smartboot.http.common.HttpEntityV2>(8080, new HttpRequestProtocol(), processor);
+        AioQuickServer<HttpEntity> server = new AioQuickServer<>(8080, new HttpRequestProtocol(), processor);
         server.setWriteQueueSize(4);
         server.setReadBufferSize(1024);
-//        server.setThreadNum(8);
         try {
             server.start();
         } catch (IOException e) {