This commit is contained in:
@@ -782,15 +782,21 @@ public final class Rest {
|
|||||||
for (final Method method : serviceType.getMethods()) {
|
for (final Method method : serviceType.getMethods()) {
|
||||||
if (Modifier.isStatic(method.getModifiers())) continue;
|
if (Modifier.isStatic(method.getModifiers())) continue;
|
||||||
if (method.isSynthetic()) continue;
|
if (method.isSynthetic()) continue;
|
||||||
Class[] extypes = method.getExceptionTypes();
|
|
||||||
if (extypes.length > 1) continue;
|
|
||||||
if (extypes.length == 1 && extypes[0] != IOException.class) continue;
|
|
||||||
if (EXCLUDERMETHODS.contains(method.getName())) continue;
|
if (EXCLUDERMETHODS.contains(method.getName())) continue;
|
||||||
if ("init".equals(method.getName())) continue;
|
if ("init".equals(method.getName())) continue;
|
||||||
if ("destroy".equals(method.getName())) continue;
|
if ("destroy".equals(method.getName())) continue;
|
||||||
if ("version".equals(method.getName())) continue;
|
if ("version".equals(method.getName())) continue;
|
||||||
|
|
||||||
RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class);
|
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 == null) continue;
|
||||||
if (!controller.automapping() && mappings.length < 1) continue;
|
if (!controller.automapping() && mappings.length < 1) continue;
|
||||||
boolean ignore = false;
|
boolean ignore = false;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static java.lang.annotation.ElementType.*;
|
|||||||
import static java.lang.annotation.RetentionPolicy.*;
|
import static java.lang.annotation.RetentionPolicy.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 只能依附在Service实现类的public方法上 <br>
|
* 只能依附在Service实现类的public方法上,且方法如果throws只能是IOException <br>
|
||||||
* value默认为"/" + Service的类名去掉Service字样的小写字符串 (如HelloService,的默认路径为/hello)。 <br>
|
* value默认为"/" + Service的类名去掉Service字样的小写字符串 (如HelloService,的默认路径为/hello)。 <br>
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: https://redkale.org
|
* 详情见: https://redkale.org
|
||||||
|
|||||||
Reference in New Issue
Block a user