File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
src/main/java/com/litongjava/tio/http/server/handler Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1111 <java .version>1.8</java .version>
1212 <maven .compiler.source>${java.version} </maven .compiler.source>
1313 <maven .compiler.target>${java.version} </maven .compiler.target>
14- <tio-boot .version>1.9.8 </tio-boot .version>
14+ <tio-boot .version>2.0.1 </tio-boot .version>
1515
1616
1717 <main .class>com.litongjava.tio.http.server.MainApp</main .class>
2626 <dependency >
2727 <groupId >com.litongjava</groupId >
2828 <artifactId >java-db</artifactId >
29- <version >1.5.0 </version >
29+ <version >1.5.3 </version >
3030 </dependency >
3131
3232 <dependency >
Original file line number Diff line number Diff line change 11package com .litongjava .tio .http .server .handler ;
22
3+ import java .nio .charset .StandardCharsets ;
4+
35import com .alibaba .fastjson2 .JSON ;
46import com .litongjava .tio .boot .http .TioRequestContext ;
57import com .litongjava .tio .http .common .HttpRequest ;
810import com .litongjava .tio .http .server .model .Message ;
911
1012/**
11- * ab -k -n1000000 -c10 http://127.0.0.1:8080/json
12- * ab -k -n1000000 -c10 http://127.0.0.1:8080/plaintext
13+ * ab -k -n1000000 -c10 http://127.0.0.1:8080/json ab -k -n1000000 -c10
14+ * http://127.0.0.1:8080/plaintext
1315 */
1416public class IndexHandler {
15- private static final String HELLO_WORLD_RN = "Hello, World!\r \n " ;
16-
17+
1718 private static final String HELLO_WORLD = "Hello, World!" ;
1819
19- private static final byte [] HELLO_WORLD_BYTES = HELLO_WORLD_RN .getBytes ();
20- private static byte [] JSON_BYTES = JSON .toJSONBytes (new Message (HELLO_WORLD ));
20+ private static final byte [] HELLO_WORLD_BYTES = HELLO_WORLD .getBytes (StandardCharsets . UTF_8 );
21+ private static final byte [] JSON_BYTES = JSON .toJSONBytes (new Message (HELLO_WORLD ));
2122
2223 public HttpResponse plaintext (HttpRequest request ) {
2324 HttpResponse response = TioRequestContext .getResponse ();
You can’t perform that action at this time.
0 commit comments