From e64a75cfab110f0e257dae75d6db34764e0699c0 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Tue, 3 Apr 2018 16:16:10 +0800 Subject: [PATCH] --- src/org/redkale/net/http/Rest.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/org/redkale/net/http/Rest.java b/src/org/redkale/net/http/Rest.java index 5dde1ff1e..e30b11326 100644 --- a/src/org/redkale/net/http/Rest.java +++ b/src/org/redkale/net/http/Rest.java @@ -786,18 +786,9 @@ public final class Rest { if ("init".equals(method.getName())) continue; if ("destroy".equals(method.getName())) continue; if ("version".equals(method.getName())) continue; + if (controller == null) continue; RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class); - Class[] extypes = method.getExceptionTypes(); - if (extypes.length > 1) { - if (mappings != null && mappings.length > 0) throw new RuntimeException("@" + RestMapping.class.getSimpleName() + " only for method with throws IOException"); - continue; - } - if (extypes.length == 1 && extypes[0] != IOException.class) { - if (mappings != null && mappings.length > 0) throw new RuntimeException("@" + RestMapping.class.getSimpleName() + " only for method with throws IOException"); - continue; - } - if (controller == null) continue; if (!controller.automapping() && mappings.length < 1) continue; boolean ignore = false; for (RestMapping mapping : mappings) { @@ -807,6 +798,16 @@ public final class Rest { } } if (ignore) continue; + + Class[] extypes = method.getExceptionTypes(); + if (extypes.length > 1) { + if (mappings != null && mappings.length > 0) throw new RuntimeException("@" + RestMapping.class.getSimpleName() + " only for method with throws IOException"); + continue; + } + if (extypes.length == 1 && extypes[0] != IOException.class) { + if (mappings != null && mappings.length > 0) throw new RuntimeException("@" + RestMapping.class.getSimpleName() + " only for method with throws IOException"); + continue; + } paramtypes.add(TypeToken.getGenericType(method.getGenericParameterTypes(), serviceType)); if (mappings.length == 0) { //没有Mapping,设置一个默认值 MappingEntry entry = new MappingEntry(methodidex, null, bigmodulename, method);