Skip to content

Commit fb4a84f

Browse files
authored
[java] Add solon-vertx (#9371)
* Update Solon Version To 2.9.1 * Update Solon Version To 2.9.1 * Update Solon Jdk To 21 * Update Solon Jdk To 21 * Update Solon Jdk To 21 * Update Solon Jdk To 21 * Update Solon Jdk To 21 * Update Solon Version To 2.9.2 * Add Solon-Virtual * Remove solon-virtual * Update Solon Version To 3.0.2 * Add Solon-Vertx * Tweak description * Tweak the dockerfile * Tweak the dockerfile * Tweak config * Tweak dockefile name * Add FilterImpl * Add FilterImpl * The json plugin is changed to jackson * Update Solon Jdk To 23 * Update Solon-Vertx Jdk To 23 * Solon-vertx is restored to jdk 21 * Solon is restored to jdk 21 * Solon-vertx adjusts the Date output format * Solon is restored to jdk 21
1 parent 59df508 commit fb4a84f

File tree

11 files changed

+222
-1
lines changed

11 files changed

+222
-1
lines changed

frameworks/Java/solon-vertx/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# solon-vertx Benchmarking Test
2+
3+
4+
This is the solon-vertx portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
5+
6+
### JSON Encoding Test
7+
* [JSON test source](src/main/java/hello/Main.java)
8+
* [Plaintext test source](src/main/java/hello/Main.java)
9+
10+
## Versions
11+
12+
* [Java OpenJDK 21](http://openjdk.java.net/)
13+
* [solon 3.0.2](https://github.com/noear/solon)
14+
15+
## Test URLs
16+
17+
### JSON Encoding Test
18+
19+
http://localhost:8080/json
20+
21+
### Plaintext Encoding Test
22+
23+
http://localhost:8080/plaintext
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"framework": "solon-vertx",
3+
"tests": [
4+
{
5+
"default": {
6+
"json_url": "/json",
7+
"plaintext_url": "/plaintext",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Fullstack",
11+
"database": "None",
12+
"framework": "solon",
13+
"language": "Java",
14+
"flavor": "None",
15+
"orm": "Micro",
16+
"platform": "Netty",
17+
"webserver": "None",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"display_name": "solon-vertx",
21+
"notes": "",
22+
"versus": "solon"
23+
}
24+
}
25+
]
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[framework]
2+
name = "solon-vertx"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Platform"
9+
database = "None"
10+
database_os = "Linux"
11+
os = "Linux"
12+
orm = "Micro"
13+
platform = "Netty"
14+
webserver = "None"
15+
versus = "solon"

frameworks/Java/solon-vertx/pom.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>org.noear</groupId>
7+
<artifactId>solon-parent</artifactId>
8+
<version>3.0.2</version>
9+
</parent>
10+
11+
<groupId>hello</groupId>
12+
<artifactId>hello-solon</artifactId>
13+
<version>1.0</version>
14+
<packaging>jar</packaging>
15+
16+
<properties>
17+
<java.version>21</java.version>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>org.noear</groupId>
23+
<artifactId>solon-boot-vertx</artifactId>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>org.noear</groupId>
28+
<artifactId>solon-serialization-jackson</artifactId>
29+
</dependency>
30+
</dependencies>
31+
32+
<build>
33+
<finalName>${project.artifactId}</finalName>
34+
35+
<plugins>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-assembly-plugin</artifactId>
39+
<configuration>
40+
<descriptorRefs>
41+
<descriptorRef>jar-with-dependencies</descriptorRef>
42+
</descriptorRefs>
43+
<archive>
44+
<manifest>
45+
<mainClass>hello.Main</mainClass>
46+
</manifest>
47+
</archive>
48+
</configuration>
49+
<executions>
50+
<execution>
51+
<id>make-assembly</id>
52+
<phase>package</phase>
53+
<goals>
54+
<goal>single</goal>
55+
</goals>
56+
</execution>
57+
</executions>
58+
</plugin>
59+
</plugins>
60+
</build>
61+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM maven:3.9.7-amazoncorretto-21 as maven
2+
WORKDIR /solon
3+
COPY pom.xml pom.xml
4+
COPY src src
5+
RUN mvn compile assembly:single -q
6+
7+
FROM openjdk:21-jdk-slim
8+
WORKDIR /solon
9+
COPY --from=maven /solon/target/hello-solon.jar app.jar
10+
11+
EXPOSE 8080
12+
13+
CMD ["java", "-server", "-cp", "app.jar", "hello.Main"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package hello;
2+
3+
import org.noear.solon.Solon;
4+
5+
/**
6+
* @author noear
7+
* @version V1.0
8+
*/
9+
public class Main {
10+
public static void main(String[] args) {
11+
Solon.start(Main.class, args);
12+
}
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package hello.controller;
2+
3+
import org.noear.solon.annotation.Component;
4+
import org.noear.solon.core.handle.Context;
5+
import org.noear.solon.core.handle.Filter;
6+
import org.noear.solon.core.handle.FilterChain;
7+
8+
import java.text.DateFormat;
9+
import java.text.SimpleDateFormat;
10+
import java.util.Date;
11+
12+
@Component
13+
public class FilterImpl implements Filter {
14+
private static DateFormat DATE_FORMAT = new SimpleDateFormat("EEE, d MMM yyyyy HH:mm:ss z");
15+
16+
@Override
17+
public void doFilter(Context ctx, FilterChain chain) throws Throwable {
18+
String dateString = DATE_FORMAT.format(new Date());
19+
ctx.headerSet("Date", dateString);
20+
ctx.headerSet("Server", "solon-boot-vertx");
21+
chain.doFilter(ctx);
22+
}
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package hello.controller;
2+
3+
import org.noear.solon.annotation.Controller;
4+
import org.noear.solon.annotation.Get;
5+
import org.noear.solon.annotation.Mapping;
6+
import hello.model.Message;
7+
8+
/**
9+
* @author noear
10+
* @version V1.0
11+
*/
12+
@Controller
13+
public class HelloController {
14+
@Get
15+
@Mapping("plaintext")
16+
public String plaintext() {
17+
return "Hello, World!";
18+
}
19+
20+
@Get
21+
@Mapping("json")
22+
public Message json() {
23+
return new Message("Hello, World!");
24+
}
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package hello.model;
2+
3+
/**
4+
* @author noear
5+
* @version V1.0
6+
*/
7+
public class Message {
8+
private String message;
9+
10+
public Message(String message) {
11+
this.message = message;
12+
}
13+
14+
public String getMessage() {
15+
return message;
16+
}
17+
18+
public void setMessage(String message) {
19+
this.message = message;
20+
}
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
server.http.ioBound=false

0 commit comments

Comments
 (0)