Skip to content

Commit 4edfc5e

Browse files
committed
Merge branch '3.5.x'
2 parents 8261ef0 + f8e1ce8 commit 4edfc5e

File tree

35 files changed

+1967
-62
lines changed

35 files changed

+1967
-62
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.fitframework.example</groupId>
7+
<artifactId>http-client</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
<java.version>17</java.version>
13+
14+
<!-- FIT version -->
15+
<fit.version>3.5.0-SNAPSHOT</fit.version>
16+
17+
<!-- Maven plugin versions -->
18+
<maven.compiler.version>3.14.0</maven.compiler.version>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.fitframework</groupId>
24+
<artifactId>fit-api</artifactId>
25+
<version>${fit.version}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.fitframework</groupId>
29+
<artifactId>fit-util</artifactId>
30+
<version>${fit.version}</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.fitframework.service</groupId>
34+
<artifactId>fit-http-classic</artifactId>
35+
<version>${fit.version}</version>
36+
</dependency>
37+
</dependencies>
38+
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<groupId>org.apache.maven.plugins</groupId>
43+
<artifactId>maven-compiler-plugin</artifactId>
44+
<version>${maven.compiler.version}</version>
45+
<configuration>
46+
<source>${java.version}</source>
47+
<target>${java.version}</target>
48+
<encoding>${project.build.sourceEncoding}</encoding>
49+
<compilerArgs>
50+
<arg>-parameters</arg>
51+
</compilerArgs>
52+
</configuration>
53+
</plugin>
54+
<plugin>
55+
<groupId>org.fitframework</groupId>
56+
<artifactId>fit-build-maven-plugin</artifactId>
57+
<version>${fit.version}</version>
58+
<executions>
59+
<execution>
60+
<id>build-plugin</id>
61+
<goals>
62+
<goal>build-plugin</goal>
63+
</goals>
64+
</execution>
65+
<execution>
66+
<id>package-plugin</id>
67+
<goals>
68+
<goal>package-plugin</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
</plugin>
73+
</plugins>
74+
</build>
75+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
package modelengine.fit.example.client;
8+
9+
import modelengine.fit.example.entity.Education;
10+
11+
import java.util.List;
12+
13+
/**
14+
* This interface defines a set of methods for testing HTTP client proxy functionality.
15+
* Each method corresponds to a specific HTTP request type and parameter binding scenario.
16+
*
17+
* @author 季聿阶
18+
* @since 2025-06-01
19+
*/
20+
public interface TestInterface {
21+
/**
22+
* Tests request bean binding by sending an Education object in the request.
23+
*
24+
* @param education The Education object to be sent in the request.
25+
* @return The modified Education object received in the response.
26+
*/
27+
Education requestBean(Education education);
28+
29+
/**
30+
* Tests path variable binding by extracting a path variable from the URL.
31+
*
32+
* @param variable The path variable extracted from the URL.
33+
* @return A string containing the path variable value.
34+
*/
35+
String pathVariable(String variable);
36+
37+
/**
38+
* Tests header binding by extracting header values from the request.
39+
*
40+
* @param header The value of the "header" header.
41+
* @param headers The list of values for the "headers" header.
42+
* @return A string containing the header values.
43+
*/
44+
String header(String header, List<Integer> headers);
45+
46+
/**
47+
* Tests cookie binding by extracting a cookie value from the request.
48+
*
49+
* @param cookieValue The value of the "cookie" cookie.
50+
* @return A string containing the cookie value.
51+
*/
52+
String cookie(String cookieValue);
53+
54+
/**
55+
* Tests query parameter binding by extracting a query parameter from the request.
56+
*
57+
* @param query The value of the "query" query parameter.
58+
* @return A string containing the query parameter value.
59+
*/
60+
String query(String query);
61+
62+
/**
63+
* Tests request body binding by extracting the request body content.
64+
*
65+
* @param requestBody The content of the request body.
66+
* @return A string containing the request body content.
67+
*/
68+
String requestBody(String requestBody);
69+
70+
/**
71+
* Tests form data binding by extracting a form field value from the request.
72+
*
73+
* @param form The value of the "form" form field.
74+
* @return A string containing the form field value.
75+
*/
76+
String form(String form);
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
package modelengine.fit.example.client;
8+
9+
import modelengine.fit.example.entity.Education;
10+
import modelengine.fit.http.annotation.GetMapping;
11+
import modelengine.fit.http.annotation.HttpProxy;
12+
import modelengine.fit.http.annotation.PatchMapping;
13+
import modelengine.fit.http.annotation.PathVariable;
14+
import modelengine.fit.http.annotation.PostMapping;
15+
import modelengine.fit.http.annotation.PutMapping;
16+
import modelengine.fit.http.annotation.RequestAddress;
17+
import modelengine.fit.http.annotation.RequestBean;
18+
import modelengine.fit.http.annotation.RequestBody;
19+
import modelengine.fit.http.annotation.RequestCookie;
20+
import modelengine.fit.http.annotation.RequestForm;
21+
import modelengine.fit.http.annotation.RequestHeader;
22+
import modelengine.fit.http.annotation.RequestMapping;
23+
import modelengine.fit.http.annotation.RequestQuery;
24+
25+
import java.util.List;
26+
27+
/**
28+
* This interface defines a set of methods for testing HTTP client proxy functionality.
29+
* It extends the TestInterface and provides specific annotations for configuring the HTTP request details.
30+
* The interface is marked with @HttpProxy to indicate it's a proxy for HTTP requests.
31+
* The @RequestAddress annotation specifies the base URL and port for the requests.
32+
* The @RequestMapping annotation sets the base path for all methods in this interface.
33+
*
34+
* @author 季聿阶
35+
* @since 2025-06-01
36+
*/
37+
@HttpProxy
38+
@RequestAddress(protocol = "http", host = "localhost", port = "8080")
39+
@RequestMapping(path = "/http-server")
40+
public interface TestRequestAddress extends TestInterface {
41+
@Override
42+
@PostMapping(path = "/request-bean")
43+
Education requestBean(@RequestBean Education education);
44+
45+
@Override
46+
@GetMapping(path = "/path-variable/{variable}")
47+
String pathVariable(@PathVariable(name = "variable") String variable);
48+
49+
@Override
50+
@GetMapping(path = "/header")
51+
String header(@RequestHeader(name = "header") String header,
52+
@RequestHeader(name = "headers") List<Integer> headers);
53+
54+
@Override
55+
@GetMapping(path = "/cookie")
56+
String cookie(@RequestCookie(name = "cookie") String cookieValue);
57+
58+
@Override
59+
@GetMapping(path = "/query")
60+
String query(@RequestQuery(name = "query") String query);
61+
62+
@Override
63+
@PatchMapping(path = "/request-body")
64+
String requestBody(@RequestBody String requestBody);
65+
66+
@Override
67+
@PutMapping(path = "/form")
68+
String form(@RequestForm(name = "form") String form);
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
package modelengine.fit.example.client;
8+
9+
import modelengine.fit.example.config.DefaultAddressLocator;
10+
import modelengine.fit.example.entity.Education;
11+
import modelengine.fit.http.annotation.GetMapping;
12+
import modelengine.fit.http.annotation.HttpProxy;
13+
import modelengine.fit.http.annotation.PatchMapping;
14+
import modelengine.fit.http.annotation.PathVariable;
15+
import modelengine.fit.http.annotation.PostMapping;
16+
import modelengine.fit.http.annotation.PutMapping;
17+
import modelengine.fit.http.annotation.RequestAddress;
18+
import modelengine.fit.http.annotation.RequestBean;
19+
import modelengine.fit.http.annotation.RequestBody;
20+
import modelengine.fit.http.annotation.RequestCookie;
21+
import modelengine.fit.http.annotation.RequestForm;
22+
import modelengine.fit.http.annotation.RequestHeader;
23+
import modelengine.fit.http.annotation.RequestMapping;
24+
import modelengine.fit.http.annotation.RequestQuery;
25+
26+
import java.util.List;
27+
28+
/**
29+
* This interface defines a set of methods for testing HTTP client proxy functionality.
30+
* It extends the TestInterface and provides specific annotations for configuring the HTTP request details.
31+
* The interface is marked with @HttpProxy to indicate it's a proxy for HTTP requests.
32+
* The @RequestAddress annotation specifies the address locator class for the requests.
33+
* The @RequestMapping annotation sets the base path for all methods in this interface.
34+
*
35+
* @author 季聿阶
36+
* @since 2025-06-01
37+
*/
38+
@HttpProxy
39+
@RequestAddress(address = DefaultAddressLocator.class)
40+
@RequestMapping(path = "/http-server")
41+
public interface TestRequestAddressClass extends TestInterface {
42+
@Override
43+
@PostMapping(path = "/request-bean")
44+
Education requestBean(@RequestBean Education education);
45+
46+
@Override
47+
@GetMapping(path = "/path-variable/{variable}")
48+
String pathVariable(@PathVariable(name = "variable") String variable);
49+
50+
@Override
51+
@GetMapping(path = "/header")
52+
String header(@RequestHeader(name = "header") String header,
53+
@RequestHeader(name = "headers") List<Integer> headers);
54+
55+
@Override
56+
@GetMapping(path = "/cookie")
57+
String cookie(@RequestCookie(name = "cookie") String cookieValue);
58+
59+
@Override
60+
@GetMapping(path = "/query")
61+
String query(@RequestQuery(name = "query") String query);
62+
63+
@Override
64+
@PatchMapping(path = "/request-body")
65+
String requestBody(@RequestBody String requestBody);
66+
67+
@Override
68+
@PutMapping(path = "/form")
69+
String form(@RequestForm(name = "form") String form);
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
package modelengine.fit.example.client;
8+
9+
import modelengine.fit.example.entity.Education;
10+
import modelengine.fit.http.annotation.GetMapping;
11+
import modelengine.fit.http.annotation.HttpProxy;
12+
import modelengine.fit.http.annotation.PatchMapping;
13+
import modelengine.fit.http.annotation.PathVariable;
14+
import modelengine.fit.http.annotation.PostMapping;
15+
import modelengine.fit.http.annotation.PutMapping;
16+
import modelengine.fit.http.annotation.RequestBean;
17+
import modelengine.fit.http.annotation.RequestBody;
18+
import modelengine.fit.http.annotation.RequestCookie;
19+
import modelengine.fit.http.annotation.RequestForm;
20+
import modelengine.fit.http.annotation.RequestHeader;
21+
import modelengine.fit.http.annotation.RequestMapping;
22+
import modelengine.fit.http.annotation.RequestQuery;
23+
24+
import java.util.List;
25+
26+
/**
27+
* This interface defines a set of methods for testing HTTP client proxy functionality.
28+
* It extends the TestInterface and provides specific annotations for configuring the HTTP request details.
29+
* The interface is marked with @HttpProxy to indicate it's a proxy for HTTP requests.
30+
* The @RequestMapping annotation sets the base URL for all methods in this interface.
31+
*
32+
* @author 季聿阶
33+
* @since 2025-06-01
34+
*/
35+
@HttpProxy
36+
@RequestMapping(path = "http://localhost:8080/http-server")
37+
public interface TestRequestAddressInClassMapping extends TestInterface {
38+
@Override
39+
@PostMapping(path = "/request-bean")
40+
Education requestBean(@RequestBean Education education);
41+
42+
@Override
43+
@GetMapping(path = "/path-variable/{variable}")
44+
String pathVariable(@PathVariable(name = "variable") String variable);
45+
46+
@Override
47+
@GetMapping(path = "/header")
48+
String header(@RequestHeader(name = "header") String header,
49+
@RequestHeader(name = "headers") List<Integer> headers);
50+
51+
@Override
52+
@GetMapping(path = "/cookie")
53+
String cookie(@RequestCookie(name = "cookie") String cookieValue);
54+
55+
@Override
56+
@GetMapping(path = "/query")
57+
String query(@RequestQuery(name = "query") String query);
58+
59+
@Override
60+
@PatchMapping(path = "/request-body")
61+
String requestBody(@RequestBody String requestBody);
62+
63+
@Override
64+
@PutMapping(path = "/form")
65+
String form(@RequestForm(name = "form") String form);
66+
}

0 commit comments

Comments
 (0)