Skip to content

Commit cf6aac3

Browse files
committed
doc: Write JavaDoc and comments for RequestMapping
1 parent 13576ee commit cf6aac3

File tree

1 file changed

+40
-0
lines changed
  • eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util

1 file changed

+40
-0
lines changed

eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/RequestMapping.java

+40
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,65 @@
2323

2424
import lombok.experimental.UtilityClass;
2525

26+
/**
27+
* This class provides utility methods for handling HTTP request mappings.
28+
*/
29+
2630
@UtilityClass
2731
public class RequestMapping {
2832

33+
/**
34+
* Performs a POST mapping for a specific URL.
35+
*
36+
* @param value the URL pattern to match
37+
* @param httpExchange the exchange containing the request from the client and used to send the response
38+
* @return {@code true} if the URL pattern matches and the HTTP method is POST, {@code false} otherwise
39+
*/
2940
public boolean postMapping(String value, HttpExchange httpExchange) {
3041
return isUrlMatch(value, httpExchange, HttpMethod.POST.name());
3142
}
3243

44+
/**
45+
* Performs a GET mapping for a specific URL.
46+
*
47+
* @param value the URL pattern to match
48+
* @param httpExchange the exchange containing the request from the client and used to send the response
49+
* @return {@code true} if the URL pattern matches and the HTTP method is GET, {@code false} otherwise
50+
*/
3351
public boolean getMapping(String value, HttpExchange httpExchange) {
3452
return isUrlMatch(value, httpExchange, HttpMethod.GET.name());
3553
}
3654

55+
/**
56+
* Performs a PUT mapping for a specific URL.
57+
*
58+
* @param value the URL pattern to match
59+
* @param httpExchange the exchange containing the request from the client and used to send the response
60+
* @return {@code true} if the URL pattern matches and the HTTP method is PUT, {@code false} otherwise
61+
*/
3762
public boolean putMapping(String value, HttpExchange httpExchange) {
3863
return isUrlMatch(value, httpExchange, HttpMethod.PUT.name());
3964
}
4065

66+
/**
67+
* Performs a DELETE mapping for a specific URL.
68+
*
69+
* @param value the URL pattern to match
70+
* @param httpExchange the exchange containing the request from the client and used to send the response
71+
* @return {@code true} if the URL pattern matches and the HTTP method is DELETE, {@code false} otherwise
72+
*/
4173
public boolean deleteMapping(String value, HttpExchange httpExchange) {
4274
return isUrlMatch(value, httpExchange, HttpMethod.DELETE.name());
4375
}
4476

77+
/**
78+
* Checks if the URL pattern matches the request URI and the HTTP method is the specified method type.
79+
*
80+
* @param value the URL pattern to match
81+
* @param httpExchange the exchange containing the request from the client and used to send the response
82+
* @param methodType the HTTP method type to check against
83+
* @return {@code true} if the URL pattern matches and the HTTP method is the specified method type, {@code false} otherwise
84+
*/
4585
private boolean isUrlMatch(String value, HttpExchange httpExchange, String methodType) {
4686
if (methodType.equalsIgnoreCase(httpExchange.getRequestMethod())) {
4787
String requestUri = httpExchange.getRequestURI().getPath();

0 commit comments

Comments
 (0)