修复Rest将Future<HttpResult<byte[]>>类型用finishJsonFuture格式输出
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -79,12 +79,12 @@ public abstract class Sncp {
|
||||
}
|
||||
|
||||
//key: actionid
|
||||
public static LinkedHashMap<Uint128, Method> loadMethodActions(final Class resourceServiceType) {
|
||||
public static LinkedHashMap<Uint128, Method> loadMethodActions(final Class serviceTypeOrImplClass) {
|
||||
final List<Method> list = new ArrayList<>();
|
||||
final List<Method> multis = new ArrayList<>();
|
||||
final Map<Uint128, Method> 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;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ public class SncpServlet extends Servlet<SncpContext, SncpRequest, SncpResponse>
|
||||
this.serviceid = Sncp.serviceid(resourceName, resourceType);
|
||||
|
||||
Class serviceImplClass = Sncp.getServiceType(service);
|
||||
RedkaleClassLoader.putReflectionPublicMethods(serviceImplClass.getName());
|
||||
for (Map.Entry<Uint128, Method> en : Sncp.loadMethodActions(serviceImplClass).entrySet()) {
|
||||
SncpActionServlet action;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user