diff --git a/src/main/java/org/redkale/net/http/Rest.java b/src/main/java/org/redkale/net/http/Rest.java index 277d34635..f8b1177b6 100644 --- a/src/main/java/org/redkale/net/http/Rest.java +++ b/src/main/java/org/redkale/net/http/Rest.java @@ -3165,7 +3165,8 @@ public final class Rest { } else if (CompletionStage.class.isAssignableFrom(returnType)) { mv.visitVarInsn(ASTORE, maxLocals); mv.visitVarInsn(ALOAD, 2); //response - if (returnGenericNoFutureType == HttpScope.class) { + Class returnNoFutureType = TypeToken.typeToClassOrElse(returnGenericNoFutureType, Object.class); + if (returnNoFutureType == HttpScope.class) { if (rcs != null && rcs.length > 0) { mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, newDynName, REST_CONVERT_FIELD_PREFIX + restConverts.size(), convertDesc); @@ -3175,10 +3176,10 @@ public final class Rest { mv.visitVarInsn(ALOAD, maxLocals); mv.visitMethodInsn(INVOKEVIRTUAL, respInternalName, "finishScopeFuture", "(" + stageDesc + ")V", false); } - } else if (returnGenericNoFutureType != byte[].class - && returnGenericNoFutureType != RetResult.class - && returnGenericNoFutureType != HttpResult.class - && returnGenericNoFutureType != File.class + } else if (returnNoFutureType != byte[].class + && returnNoFutureType != RetResult.class + && returnNoFutureType != HttpResult.class + && returnNoFutureType != File.class && !((returnGenericNoFutureType instanceof Class) && (((Class) returnGenericNoFutureType).isPrimitive() || CharSequence.class.isAssignableFrom((Class) returnGenericNoFutureType)))) { if (rcs != null && rcs.length > 0) { mv.visitVarInsn(ALOAD, 0); diff --git a/src/main/java/org/redkale/net/sncp/Sncp.java b/src/main/java/org/redkale/net/sncp/Sncp.java index b8b047e50..b557c2dd7 100644 --- a/src/main/java/org/redkale/net/sncp/Sncp.java +++ b/src/main/java/org/redkale/net/sncp/Sncp.java @@ -79,12 +79,12 @@ public abstract class Sncp { } //key: actionid - public static LinkedHashMap loadMethodActions(final Class resourceServiceType) { + public static LinkedHashMap loadMethodActions(final Class serviceTypeOrImplClass) { final List list = new ArrayList<>(); final List multis = new ArrayList<>(); final Map actionids = new LinkedHashMap<>(); - RedkaleClassLoader.putReflectionPublicMethods(resourceServiceType.getName()); - for (final java.lang.reflect.Method method : resourceServiceType.getMethods()) { + RedkaleClassLoader.putReflectionPublicMethods(serviceTypeOrImplClass.getName()); + for (final java.lang.reflect.Method method : serviceTypeOrImplClass.getMethods()) { if (method.isSynthetic()) { continue; } @@ -116,7 +116,7 @@ public abstract class Sncp { Method old = actionids.get(actionid); if (old != null) { if (old.getDeclaringClass().equals(method.getDeclaringClass())) { - throw new SncpException(resourceServiceType.getName() + " have one more same action(Method=" + method + ", " + old + ", actionid=" + actionid + ")"); + throw new SncpException(serviceTypeOrImplClass.getName() + " have one more same action(Method=" + method + ", " + old + ", actionid=" + actionid + ")"); } continue; } diff --git a/src/main/java/org/redkale/net/sncp/SncpServlet.java b/src/main/java/org/redkale/net/sncp/SncpServlet.java index 9ee7200c9..647ed8f2f 100644 --- a/src/main/java/org/redkale/net/sncp/SncpServlet.java +++ b/src/main/java/org/redkale/net/sncp/SncpServlet.java @@ -56,7 +56,6 @@ public class SncpServlet extends Servlet this.serviceid = Sncp.serviceid(resourceName, resourceType); Class serviceImplClass = Sncp.getServiceType(service); - RedkaleClassLoader.putReflectionPublicMethods(serviceImplClass.getName()); for (Map.Entry en : Sncp.loadMethodActions(serviceImplClass).entrySet()) { SncpActionServlet action; try {