瀏覽代碼

upgrade to tio-boot 2.0.1 (#10063)

* update to tio-boot v1.9.7

* upgrade to tio-boot v1.9.8

* upgrade to 2.0.1
Tong Li 2 周之前
父節點
當前提交
9526fa9398

+ 2 - 2
frameworks/Java/tio-boot/pom.xml

@@ -11,7 +11,7 @@
     <java.version>1.8</java.version>
     <maven.compiler.source>${java.version}</maven.compiler.source>
     <maven.compiler.target>${java.version}</maven.compiler.target>
-    <tio-boot.version>1.9.8</tio-boot.version>
+    <tio-boot.version>2.0.1</tio-boot.version>
 
 
     <main.class>com.litongjava.tio.http.server.MainApp</main.class>
@@ -26,7 +26,7 @@
     <dependency>
       <groupId>com.litongjava</groupId>
       <artifactId>java-db</artifactId>
-      <version>1.5.0</version>
+      <version>1.5.3</version>
     </dependency>
 
     <dependency>

+ 7 - 6
frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/handler/IndexHandler.java

@@ -1,5 +1,7 @@
 package com.litongjava.tio.http.server.handler;
 
+import java.nio.charset.StandardCharsets;
+
 import com.alibaba.fastjson2.JSON;
 import com.litongjava.tio.boot.http.TioRequestContext;
 import com.litongjava.tio.http.common.HttpRequest;
@@ -8,16 +10,15 @@ import com.litongjava.tio.http.common.utils.MimeTypeUtils;
 import com.litongjava.tio.http.server.model.Message;
 
 /**
- * ab -k -n1000000 -c10 http://127.0.0.1:8080/json 
- * ab -k -n1000000 -c10 http://127.0.0.1:8080/plaintext
+ * ab -k -n1000000 -c10 http://127.0.0.1:8080/json ab -k -n1000000 -c10
+ * http://127.0.0.1:8080/plaintext
  */
 public class IndexHandler {
-  private static final String HELLO_WORLD_RN = "Hello, World!\r\n";
-  
+
   private static final String HELLO_WORLD = "Hello, World!";
 
-  private static final byte[] HELLO_WORLD_BYTES = HELLO_WORLD_RN.getBytes();
-  private static byte[] JSON_BYTES = JSON.toJSONBytes(new Message(HELLO_WORLD));
+  private static final byte[] HELLO_WORLD_BYTES = HELLO_WORLD.getBytes(StandardCharsets.UTF_8);
+  private static final byte[] JSON_BYTES = JSON.toJSONBytes(new Message(HELLO_WORLD));
 
   public HttpResponse plaintext(HttpRequest request) {
     HttpResponse response = TioRequestContext.getResponse();