diff --git a/jcommon/docean/README.md b/jcommon/docean/README.md
index 3919b1f98..25b43c750 100644
--- a/jcommon/docean/README.md
+++ b/jcommon/docean/README.md
@@ -4,7 +4,7 @@
* Based on Java20
* Fully utilized coroutines and ScopeValue
* JVM parameters that need to be added:
- --enable-preview --add-modulesjdk.incubator.concurrent -ea --add-opensjava.base/java.lang=ALL-UNNAMED--add-opensjava.base/jdk.internal.misc=ALL-UNNAMED-Dio.netty.tryReflectionSetAccessible=true
+ --enable-preview--add-modulesjdk.incubator.concurrent-ea--add-opensjava.base/java.lang=ALL-UNNAMED--add-opensjava.base/jdk.internal.misc=ALL-UNNAMED-Dio.netty.tryReflectionSetAccessible=true
* A lightweight microservices development framework. It can be embedded into the Spring framework.
* Features: Compliant with Java standards, lightweight, no unnecessary libraries, low memory footprint, fast service
requests, high maintainability, and supports plugin extensions.
diff --git a/jcommon/docean/pom.xml b/jcommon/docean/pom.xml
index 448cd20de..464159cfb 100644
--- a/jcommon/docean/pom.xml
+++ b/jcommon/docean/pom.xml
@@ -65,14 +65,6 @@
21
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 21
-
-
diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Mvc.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Mvc.java
index cc61fd289..c42c9be6a 100644
--- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Mvc.java
+++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Mvc.java
@@ -171,12 +171,8 @@ public void callMethod(MvcContext context, MvcRequest request, MvcResponse respo
Safe.run(() -> {
JsonElement args = getArgs(method, request.getMethod().toLowerCase(Locale.ROOT), request);
context.setParams(args);
- Object[] params = new Object[]{null};
- if (method.getMethod().getParameterTypes().length == 1 && method.getMethod().getParameterTypes()[0].equals(MvcContext.class)) {
- params[0] = context;
- } else {
- params = methodInvoker.getMethodParams(method.getMethod(), args);
- }
+ Object[] params = methodInvoker.getMethodParams(method.getMethod(), args);
+ setMvcContext(context, params);
Object data = this.mvcConfig.isUseCglib() ? methodInvoker.invokeFastMethod(method.getObj(), method.getMethod(), params) :
methodInvoker.invokeMethod(method.getObj(), method.getMethod(), params);
diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java
index 085bac1b6..4330d22a9 100644
--- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java
+++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java
@@ -17,8 +17,6 @@
package com.xiaomi.youpin.docean.mvc;
import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
import com.xiaomi.youpin.docean.anno.RequestParam;
import com.xiaomi.youpin.docean.mvc.httpmethod.HttpMethodUtils;
import io.netty.handler.codec.http.QueryStringDecoder;
@@ -33,18 +31,14 @@
*/
public abstract class Get {
- public static JsonElement getParams(HttpRequestMethod method, String uri) {
+ public static JsonArray getParams(HttpRequestMethod method, String uri) {
QueryStringDecoder decoder = new QueryStringDecoder(uri);
Map params = decoder.parameters().entrySet().stream().collect(Collectors.toMap(it -> it.getKey(), it -> it.getValue().get(0)));
-
- //只有一个参数,并且是MvcContext
- if (HttpMethodUtils.paramIsMvcContext(method)) {
- JsonObject res = new JsonObject();
- params.entrySet().forEach(it-> res.addProperty(it.getKey(),it.getValue()));
- return res;
- }
-
JsonArray array = new JsonArray();
+ HttpMethodUtils.addMvcContext(method, array);
+ if (null == params) {
+ return array;
+ }
Annotation[][] anns = method.getMethod().getParameterAnnotations();
Arrays.stream(anns).forEach(it -> {
if (it.length > 0) {
@@ -52,6 +46,7 @@ public static JsonElement getParams(HttpRequestMethod method, String uri) {
String name = param.value();
if (!params.containsKey(name)) {
array.add("");
+// throw new DoceanException("Missing parameter:" + name);
} else {
array.add(params.get(name));
}
diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/httpmethod/HttpMethodUtils.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/httpmethod/HttpMethodUtils.java
index ff6e7e889..d91d9faf5 100644
--- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/httpmethod/HttpMethodUtils.java
+++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/httpmethod/HttpMethodUtils.java
@@ -12,17 +12,10 @@
public class HttpMethodUtils {
public static void addMvcContext(HttpRequestMethod method, JsonArray array) {
- if (paramIsMvcContext(method)) {
- array.add(new JsonObject());
- }
- }
-
- public static boolean paramIsMvcContext(HttpRequestMethod method) {
Class>[] types = method.getMethod().getParameterTypes();
if (types.length > 0 && types[0] == MvcContext.class) {
- return true;
+ array.add(new JsonObject());
}
- return false;
}