Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions frameworks/Java/tio-http-server/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.litongjava</groupId>
<artifactId>tio-http-server-benchmark</artifactId>
Expand All @@ -18,17 +16,18 @@
<dependency>
<groupId>com.litongjava</groupId>
<artifactId>tio-http-server</artifactId>
<version>3.7.3.v20250301-RELEASE</version>
<version>3.7.3.v20250401-RELEASE</version>
</dependency>
<dependency>

<dependency>
<groupId>com.litongjava</groupId>
<artifactId>tio-core</artifactId>
<version>3.7.3.v20250305-RELEASE</version>
<artifactId>tio-utils</artifactId>
<version>3.7.3.v20250401-RELEASE</version>
</dependency>
<dependency>
<groupId>com.litongjava</groupId>
<artifactId>java-db</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -62,6 +61,12 @@
<version>4.0.3</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
</dependency>

</dependencies>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.litongjava.tio.http.server.config.EhCachePluginConfig;
import com.litongjava.tio.http.server.config.EnjoyEngineConfig;
import com.litongjava.tio.http.server.config.MysqlDbConfig;
import com.litongjava.tio.http.server.controller.CacheController;
import com.litongjava.tio.http.server.controller.DbController;
import com.litongjava.tio.http.server.controller.IndexController;
import com.litongjava.tio.http.server.handler.CacheHandler;
import com.litongjava.tio.http.server.handler.DbHandler;
import com.litongjava.tio.http.server.handler.DefaultHttpRequestDispatcher;
import com.litongjava.tio.http.server.handler.IndexHandler;
import com.litongjava.tio.http.server.router.DefaultHttpRequestRouter;
import com.litongjava.tio.http.server.router.HttpRequestRouter;
import com.litongjava.tio.server.ServerTioConfig;
Expand All @@ -21,20 +21,20 @@ public static void main(String[] args) {
EnvUtils.buildCmdArgsMap(args);
EnvUtils.load();
// add route
IndexController controller = new IndexController();
IndexHandler controller = new IndexHandler();

HttpRequestRouter simpleHttpRoutes = new DefaultHttpRequestRouter();
simpleHttpRoutes.add("/", controller::index);
simpleHttpRoutes.add("/plaintext", controller::plaintext);
simpleHttpRoutes.add("/json", controller::json);

DbController dbQueryController = new DbController();
DbHandler dbQueryController = new DbHandler();
simpleHttpRoutes.add("/db", dbQueryController::db);
simpleHttpRoutes.add("/queries", dbQueryController::queries);
simpleHttpRoutes.add("/updates", dbQueryController::updates);
simpleHttpRoutes.add("/fortunes", dbQueryController::fortunes);

CacheController cacheController = new CacheController();
CacheHandler cacheController = new CacheHandler();
simpleHttpRoutes.add("/cachedQuery", cacheController::cachedQuery);

// config server
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.litongjava.tio.http.server.controller;
package com.litongjava.tio.http.server.handler;

import java.util.List;
import java.util.Map;
Expand All @@ -14,7 +14,7 @@
import com.litongjava.tio.http.common.HttpResponse;
import com.litongjava.tio.http.server.utils.RandomUtils;

public class CacheController {
public class CacheHandler {
// private Logger log = LoggerFactory.getLogger(this.getClass());

public HttpResponse cachedQuery(HttpRequest request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.litongjava.tio.http.server.controller;
package com.litongjava.tio.http.server.handler;

import java.util.ArrayList;
import java.util.Comparator;
Expand All @@ -22,7 +22,7 @@
import com.litongjava.tio.http.server.util.Resps;
import com.litongjava.tio.http.server.utils.RandomUtils;

public class DbController {
public class DbHandler {

public HttpResponse db(HttpRequest request) {
Integer id = request.getInt("id");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.litongjava.tio.http.server.controller;
package com.litongjava.tio.http.server.handler;

import com.alibaba.fastjson2.JSON;
import com.litongjava.tio.http.common.HeaderName;
Expand All @@ -12,7 +12,7 @@
* ab -k -n1000000 -c10 http://127.0.0.1:8080/json
* ab -k -n1000000 -c10 http://127.0.0.1:8080/plaintext
*/
public class IndexController {
public class IndexHandler {
private static final String HELLO_WORLD = "Hello, World!";

private static final byte[] HELLO_WORLD_BYTES = HELLO_WORLD.getBytes();
Expand Down
Loading