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 11
11
<java .version>1.8</java .version>
12
12
<maven .compiler.source>${java.version} </maven .compiler.source>
13
13
<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>
15
15
16
16
17
17
<main .class>com.litongjava.tio.http.server.MainApp</main .class>
26
26
<dependency >
27
27
<groupId >com.litongjava</groupId >
28
28
<artifactId >java-db</artifactId >
29
- <version >1.5.0 </version >
29
+ <version >1.5.3 </version >
30
30
</dependency >
31
31
32
32
<dependency >
Original file line number Diff line number Diff line change 1
1
package com .litongjava .tio .http .server .handler ;
2
2
3
+ import java .nio .charset .StandardCharsets ;
4
+
3
5
import com .alibaba .fastjson2 .JSON ;
4
6
import com .litongjava .tio .boot .http .TioRequestContext ;
5
7
import com .litongjava .tio .http .common .HttpRequest ;
8
10
import com .litongjava .tio .http .server .model .Message ;
9
11
10
12
/**
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
13
15
*/
14
16
public class IndexHandler {
15
- private static final String HELLO_WORLD_RN = "Hello, World!\r \n " ;
16
-
17
+
17
18
private static final String HELLO_WORLD = "Hello, World!" ;
18
19
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 ));
21
22
22
23
public HttpResponse plaintext (HttpRequest request ) {
23
24
HttpResponse response = TioRequestContext .getResponse ();
You can’t perform that action at this time.
0 commit comments