createRestServlet兼容throws IOException和RuntimeException的子类
This commit is contained in:
@@ -750,13 +750,12 @@ public final class Rest {
|
|||||||
if (ignore) continue;
|
if (ignore) continue;
|
||||||
|
|
||||||
Class[] extypes = method.getExceptionTypes();
|
Class[] extypes = method.getExceptionTypes();
|
||||||
if (extypes.length > 1) {
|
if (extypes.length > 0) {
|
||||||
if (mappings != null && mappings.length > 0) throw new RuntimeException("@" + RestMapping.class.getSimpleName() + " only for method with throws IOException");
|
for (Class exp : extypes) {
|
||||||
continue;
|
if (!RuntimeException.class.isAssignableFrom(exp) && !IOException.class.isAssignableFrom(exp)) {
|
||||||
}
|
throw new RuntimeException("@" + RestMapping.class.getSimpleName() + " only for method(" + method + ") with throws IOException");
|
||||||
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));
|
paramtypes.add(TypeToken.getGenericType(method.getGenericParameterTypes(), serviceType));
|
||||||
if (mappings.length == 0) { //没有Mapping,设置一个默认值
|
if (mappings.length == 0) { //没有Mapping,设置一个默认值
|
||||||
|
|||||||
Reference in New Issue
Block a user